Commit Graph

8965 Commits

Author SHA1 Message Date
Andrzej Puzdrowski bd48673fb5 drivers/eeprom/eeprom_emulator: remove flash_write_protection_set() usage
This patch removes scenario which was testing deprecated
API behaviors. Needed as As flash_write_protection_set() was
deprecated and became no-operation.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski e55532c639 drivers/flash/flash_shell: remove flash_write_protection_set() usage
This patch removes scenario which was testing deprecated
API behaviors. Needed as As flash_write_protection_set() was
deprecated and became no-operation.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski 1960a5d234 disk/disk_acces_flash: remove flash_write_protection_set() usage
This patch removes scenario which was testing deprecated
API behaviors. Needed as As flash_write_protection_set() was
deprecated and became no-operation.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski 7d53e0118b drivers/flash: removed write protection API implementations
flash_write_protection_set() API was deprecated so driver
implementation interface is left behind as well.

This patch removes all implementation pointed by the interface
'struct flash_driver_api.write_protection'.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski 7c01b18de7 drivers/flash/flash_simulator: integrate WP service into write/erase
Flash write protection services were integrated into erase and write
procedures. This is step required for fixing following issue:
Multi-threading flash access is not supported by
flash_write_protection_set().

flash_write_protection_set() will be deprecated

As CONFIG_FLASH_SIMULATOR_ERASE_PROTECT become a dead option.
this commit removes it as well.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski 7f01abadde drivers/flash/soc_flash_nios2_qspi: integrate WP service into write/erase
Flash write protection services were integrated into erase and write
procedures. This is step required for fixing following issue:
Multi-threading flash access is not supported by
flash_write_protection_set().

flash_write_protection_set() will be deprecated

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski 0172cc159d drivers/flash/flash_stm32_qspi: integrate WP service into write/erase
Flash write protection services were integrated into erase and write
procedures. This is step required for fixing following issue:
Multi-threading flash access is not supported by
flash_write_protection_set().

flash_write_protection_set() will be deprecated

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski 14e7c5a5aa drivers/flash/flash_stm32h7x: integrate WP service into write/erase
Flash write protection services were integrated into erase and write
procedures. This is step required for fixing following issue:
Multi-threading flash access is not supported by
flash_write_protection_set().

flash_write_protection_set() will be deprecated

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski 6e4cdb0c99 drivers/flash/flash_stm32: integrate WP service into write/erase
Flash write protection services were integrated into erase and write
procedures. This is step required for fixing following issue:
Multi-threading flash access is not supported by
flash_write_protection_set().

flash_write_protection_set() will be deprecated

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski fb6e824456 drivers/flash/flash_gecko: integrate WP service into write/erase
Flash write protection services were integrated into erase and write
procedures. This is step required for fixing following issue:
Multi-threading flash access is not supported by
flash_write_protection_set().

flash_write_protection_set() will be deprecated

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski bcfd9e8daf drivers/flash/soc_flash_sam0: integrate WP service into write/erase
Flash write protection services were integrated into erase and write
procedures. This is step required for fixing following issue:
Multi-threading flash access is not supported by
flash_write_protection_set().

flash_write_protection_set() will be deprecated

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski 95d75bbbab drivers/flash/soc_flash_sam: integrate WP service into write/erase
Flash write protection services were integrated into erase and write
procedures. This is step required for fixing following issue:
Multi-threading flash access is not supported by
flash_write_protection_set().

Write procedure was fixed so it doesn't lock the driver after
failure anymore.

flash_write_protection_set() will be deprecated.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski 72394f783a drivers/flash/soc_flash_rv32m1: integrate WP service into write/erase
Flash write protection services were integrated into erase and write
procedures. This is step required for fixing following issue:
Multi-threading flash access is not supported by
flash_write_protection_set().

flash_write_protection_set() will be deprecated.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski 8e3eb3c740 drivers/flash/soc_flash_lpc: integrate protection service into write/erase
Flash write protection services were integrated into erase and write
procedures. This is step required for fixing following issue:
Multi-threading flash access is not supported by
flash_write_protection_set().

flash_write_protection_set() will be deprecated.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski 5d5018e4e5 drivers/flash/soc_flash_mcux: integrate protection service into write/erase
Flash write protection services were integrated into erase and write
procedures. This is step required for fixing following issue:
Multi-threading flash access is not supported by
flash_write_protection_set().

flash_write_protection_set() will be deprecated.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski 48c7e0dd94 drivers/flash/spi_nor: integrate protection service into write/erase
Flash write protection services were integrated into erase and write
procedures. This is step required for fixing following issue:
Multi-threading flash access is not supported by
flash_write_protection_set().

flash_write_protection_set() will be deprecated.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski e034d7fd07 drivers/flash/nrf_qspi_nor: integrate protection service into write/erase
Flash write protection services were integrated into erase and write
procedures. This is step required for fixing following issue:
Multi-threading flash access is not supported by
flash_write_protection_set().

flash_write_protection_set() will be deprecated.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Jeremy Wood 5164d65269 drivers: usb: device: Add support for USB FS on STM32H7.
* Assumes that the USB2_OTG peripheral is being used in FS mode, as on
  the NUCLEO-H743/753.
* Disable ULPI on USB2_OTFG, enable FS clk.
* Enable USB voltage detect and disable USB reg, per STM app notes.

Signed-off-by: Jeremy Wood <jeremy@bcdevices.com>
2021-03-29 13:42:46 -04:00
Petri Oksanen 4c88abcf7f drivers: nrf: uarte: rx flush amount calculation
The NRF UARTE has an undocumented feature that when you flush the RX
FIFO, the RXAMOUNT register is not cleared to zero if the FIFO is in
fact empty. This fix is correcting something that was most likely a
typo.

Signed-off-by: Petri Oksanen <petri@iote.ai>
2021-03-29 14:16:50 +02:00
Francois Ramu 9d2aead97b drivers: timer: st_stm32: add lptimer management to stm32l5 series
This patch introduces the support of the LowPower Timer
for the STM32L5xx from STMicroelectronics.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-03-26 18:06:01 -04:00
Gustavo Romero 5f40b5d4f9 drivers: uart: uart_cmsdk_apb: Fix uart_irq_is_pending
Currently CMSDK uart_irq_is_pending does not use RX and TX interrupt
bits found in INTSTATUS register to check for pending interrutps but
rather it checks for pending interrupts indirectly by checking if RX and
TX buffers are, respectively, full and empty, i.e. it checks bits 0 and
1 in STATE register instead of bits meant for interrupt status found in
INTSTATUS register.

That is particularly problematic because although a RX interrupt implies
a RX buffer full and a TX interrupt implies a TX buffer empty, the
converse is not true. For instance, a TX buffer might be empty for all
data was processed (sent to serial line) already and no further data was
pushed into TX buffer so it remained empty, without generating any
additional TX interrupt. In that case the current uart_irq_is_pending
implementation reports that there are pending interrupts because of the
following logic:

/* Return true if rx buffer full or tx buffer empty */
return (UART_STRUCT(dev)->state & (UART_RX_BF | UART_TX_BF))
                                != UART_TX_BF;

which will return 1 (true) if STATE[0] = 0 (TX buffer is empty), since
UART_TX_BF = 1, so STATE[0] != UART_TX_BF, which is true (assuming here
for the sake of simplicity that UART_RX_BF = 0, i.e. RX buffer is empty
too).

One of the common uses of uart_irq_is_pending is in ISR in contructs
like the following:

while (uart_irq_update(dev) && uart_irq_is_pending(dev)) {
  if (uart_irq_rx_ready(dev) == 0) { // RX buffer is empty
    continue;
  }
  // RX buffer is full, process RX data
}

So the ISR can be called due to a RX interrupt. Upon finishing
processing the RX data uart_irq_is_pending is called to check for any
pending IRQs and if it happens that TX buffer is empty (like in the case
that TX interrupt is totally disabled) execution gets stuck in the while
loop because TX buffer will never transition to full again, i.e. it will
never have a chance to have STATE[0] = 1, so STATE[0] != UART_TX_BF is
always true.

This commit fixes that undesirable and problematic behavior by making
uart_irq_is_pending use the proper bits in the interrupt status register
(INTSTATUS) to determine if there is indeed any pending interrupts.

That, on the other hand, requires that the pending interrupt flags are
not clearly automatically when calling the ISR, otherwise
uart_irq_is_pending() will return immediatly false on the first call
without any data being really processed inside the ISR. Thus, because
both RX and TX buffer (FIFO) are only 1 byte long, that commit clears
the proper interrupts flags precisely when data is processed (fifo_read
and fifo_fill) or when the interrupts are disabled (irq_rx_disable and
irq_tx_disable).

Finally, that commits also takes the chance to update some comments,
specially regarding the need to "prime" when enabling the TX interrupts
(in uart_cmsdk_apb_irq_tx_enable()). The need to "prime" can be verified
in the CMSDK UART reference implementation in Verilog mentioned in the
"Arm Cortex-M System Design Kit" [0], on p. 4-8, section 4.3,
in cmsdk_apb_uart.v. In that implementation it's also possible to verify
that the FIFO is only 1 byte long, justifying the semantics that if
buffers are not full (STATE[0] or STATE[1] = 0) they are _completly_
empty, holding no data at all.

[0] https://documentation-service.arm.com/static/5e8f1c777100066a414f770b

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
2021-03-26 08:39:33 -04:00
Rich Barlow 9f2a65e74e disk: sdhc: Switch to clock frequency from DTS
The "spi-max-frequency" property already exists, but was unused. This
now sets the SPI clock frequency to this value (limited to 24MHz) once
initialisation is complete.

Due to the nature of the SPI API, it is necessary to have two separate
configuration structures to switch clock speed as some SPI drivers only
compare pointers to detect changes.

Fixes: #32996

Signed-off-by: Rich Barlow <rich@bennellick.com>
2021-03-26 08:34:43 -04:00
Flavio Ceolin 169144afa1 drivers: flash: Fix variable type
erase_page returns a negative value in case of error. We should
not use an unsigned type.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-03-26 07:13:13 -04:00
Flavio Ceolin 799147f43a drivers: ethernet: Fix variable type
net_recv_data returns an int, so we should not use an unsigned type.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-03-26 07:13:13 -04:00
Flavio Ceolin 6771f7bb90 drivers: hwinfo: Remove invalid comparison
size_t is never lesser than zero. Just remove it.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-03-26 07:13:13 -04:00
Flavio Ceolin 6f629b1727 drivers: flash: Fix variable type
erase_sector returns a signed type and we should not use
an unsgined type.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-03-26 07:13:13 -04:00
Mulin Chao 291c61fd47 driver: timer: npcx: fix dead code flow for K_TICKS_FOREVER.
Fix dead code flow if ticks is K_TICKS_FOREVER.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-03-26 07:03:09 -04:00
Christian Taedcke b0b20112e8 drivers: sensor: ccs811: fix sw reset delay
Before this change, the sw reset did not work after power-on, because
I2C commands are only accepted after 20msec (t_START after power-on).

Now the 20msec delay is moved before performing the reset to ensure that
the SW reset command can be executed. An additional 2msec delay is added
after the reset (see datasheet t_START after reset).

Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
2021-03-25 16:58:42 -05:00
Flavio Ceolin 9fd4ea91b7 coccinelle: Remove extra semicolon
coccicheck --mode=patch --cocci=semicolon.cocci

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-03-25 11:35:30 -05:00
Krzysztof Chruscinski ab49673bc8 drivers: timer: nrf_rtc_timer: Change type of channel argument
There was an inconsistency in the API as z_nrf_rtc_timer_chan_alloc
returned int but other function were using uint32_t for channel
argument. Updated api to use int32_t everywhere.

Update nrf_802154 driver which was using this api to use int32_t.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-03-25 15:54:49 +01:00
Francois Ramu 1804d7f5f0 drivers: clock_control of the stm32mp1 remove unknown bits
The bit RCC_MC_APB3ENSETR_PMBCTRL and RCC_MC_AHB5ENSETR_AXIMC
does not exist in the stm32mp1xx ref manual anymore.
They are not present in the stm32mp1xx_ll_bus.h (v1.4.0).

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-03-25 08:58:10 -05:00
Kumar Gala 0bb4665df7 include: Move ptp_clock.h to drivers/ptp_clock.h
Move ptp_clock.h out of the top level include/ dir into
include/drivers/ptp_clock.h and deprecated the old location.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-25 10:09:33 +02:00
Johann Fischer 63ca48a7a9 drivers: usb_dc_native_posix: use ep_dir and ep_idx in usbip_send_common
Use ep_idx in usbip_send_common() instead of endpoint address
and get direction from endpoint address.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-24 15:02:49 +01:00
Johann Fischer 735ba17cad drivers: usb_dc_native_posix: read setup packet as part of submit struct
USB setup packet is a part of USBIP_CMD_SUBMIT, but missing
in struct usbip_submit. This patch fixes it and removes
usbip_skip_setup() and adds an additional integrity check
in handle_usb_control().

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-24 15:02:49 +01:00
Johann Fischer 6c214f796e drivers: usb_dc_native_posix: rework how OUT endpoint data is passed
The transfer length is not stored and processed properly.
Use struct usb_ep_ctrl_prv, which we already have, to store
the transfer length and data. Move usbip_recv() to
handle_usb_control() and handle_usb_data(),
and explicitly copy USB setup packet.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-24 15:02:49 +01:00
Johann Fischer 77c2c1230b drivers: usb_dc_native_posix: do not use IN callback without reason
Call the IN callback only if data in usb_dc_ep_write()
is actually written to the intermediate buffer and sent.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-24 15:02:49 +01:00
Johann Fischer 16cd3be690 drivers: usb_dc_native_posix: rework handle_usb_control/handle_usb_data
Use pointer to struct usb_ep_ctrl_prv, which allows to remove
a few variables and simplifies subsequent improvements.

Use consistently ep_idx in handle_usb_control() instead of
ntohl(hdr->common.ep).

Revise logging so that it is clearer what event is being processed.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-24 15:02:49 +01:00
Robert Lubos e45de8d703 drivers: modem: wncm14a2a: Explicitly ignore unused return value
Coverity complains about unchecked return value for `k_sem_take` which
is called with `K_FOREVER` and thus cannot expire/timeout. Explicity
ingore the return value to silence Coverity.

CID: 219676
Fixes #33019

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-03-24 12:23:55 +01:00
Kumar Gala 19121106f0 pinmux: s1000: Change to use ENOTSUP
Changed to use -ENOTSUP instead of -ENOSYS to be consistent with
other driver APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-23 15:46:10 -05:00
Kumar Gala 2235c71ced drivers: wifi: Remove unncessary zephyr_include_directories
Several wifi drivers add some form of zephyr_include_directories(.)
which isn't needed since the headers in the specific driver dir get
included via #include "foo.h".  So we can remove any uses of
zephyr_include_directories(.)

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-23 13:14:38 -05:00
Kumar Gala 95e4b3eb2c arch: arm: Add initial support for Cortex-M55 Core
Add initial support for the Cortex-M55 Core which is an implementation
of the Armv8.1-M mainline architecture and includes support for the
M‑profile Vector Extension (MVE).

The support is based on the Cortex-M33 support that already exists in
Zephyr.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-23 13:13:32 -05:00
Johann Fischer 45d468bfdb include: move disk driver interface to own header
Move disk driver interface to own header and
separate disk access interface and disk driver interface.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-23 12:16:01 +01:00
Johann Fischer e3e25d0a58 drivers: usdhc: fixup i.MX RT related code after driver relocation
Fixup i.MX RT related code after driver relocation.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-23 12:16:01 +01:00
Johann Fischer 69a5f07d16 drivers: disk: cleanup after driver relocation
Add common SDMMC_LOG_LEVEL and SDMMC_VOLUME_NAME.
Initialize drivers at POST_KERNEL level.
Update CODEOWNERS after sdmmc drivers relocation.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-23 12:16:01 +01:00
Johann Fischer 03101e75d8 disk: move disk and sdmmc controller drivers to drivers/disk
The files disk_access_usdhc.c, disk_access_spi_sdhc.c,
disk_access_stm32_sdmmc.c, disk_access_ram.c and
disk_access_flash.c are actually drivers for block devices and SD/MMC
controllers. This patch moves this drivers to drivers/disk and
reworks the configuration so that the drivers are selected when
the corresponding node is enabled.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-23 12:16:01 +01:00
Steven Daglish 8f13b7860e sensor: mcp9808: Bug fix for setting resolution
Resolution currently only gets set if CONFIG_MCP9808_TRIGGER is also
set. If CONFIG_MCP9808_TRIGGER is not set, resolution gets not to '0'.

This small bug fix moves resolution to before CONFIG_MCP9808_TRIGGER is
checked, so that the resolution is changed as required.

Signed-off-by: Steven Daglish <s.c.daglish@gmail.com>
2021-03-23 12:13:45 +01:00
Pieter De Gendt 000924c8eb sensor: bq27421: lazy configure fuel gauge
The BQ274XX driver init function performs a lot i2c transfers
that slow down booting the system. We can do this lazely on the
first sample request to speed up the boot.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2021-03-23 12:13:20 +01:00
Anas Nashif 5d6c219210 drivers: device: do not reuse tag name 'device'
Do not reuse tag name (misra rule 5.7).

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-22 19:48:14 -04:00
Andrei Emeltchenko 365be4540b edac: ibecc: Add supported SKU device IDs
List all supported device IDs found in External Design Specification
Volume 1 which have IBECC supported.

Fixes #33543

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-03-22 13:05:01 -04:00
Flavio Ceolin a6183cff87 pm: docs: sys_suspend -> pm_system_suspend
Change references to an old function name.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-03-22 12:42:30 -04:00