Commit graph

64412 commits

Author SHA1 Message Date
Keith Packard 4fc00cae7a kernel: Allow Zephyr to use libc's internal errno
For a library which already provides a multi-thread aware errno, use
that instead of creating our own internal value.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-05-12 19:06:48 -04: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
Mark Holden df6b8c3cc4 coredump: arm: Capture callee registers during k_panic() / k_oops
Ensure callee registers included in coredump.
Push callee registers onto stack and pass as param to
z_do_kernel_oops for CONFIG_ARMV7_M_ARMV8_M_MAINLINE
when CONFIG_EXTRA_EXCEPTION_INFO enabled.

Signed-off-by: Mark Holden <mholden@fb.com>
2022-05-12 19:03:34 -04:00
Daniel DeGrasse b6377cce6a boards: imx8mp: partial pin control support
Add partial pin control support for the imx8mp. Since the UART driver is
not currently enabled, pin control cannot be tested on this platform.
Therefore, only the DTS definitions required to set the pinmux options
are present for this platform, and are not being applied (since
CONFIG_PINCTRL=n).

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-12 16:57:17 -05:00
Daniel DeGrasse 946b9dc1e1 boards: imx8mm: add partial pin control support
Add initial pin control support for the A53 core of the imx8mm. Since
the UART console driver is not currently enabled for this platform,
there is no way to test the full pin control enablement. Therefore,
CONFIG_PINCTRL is still not selected for this platform, although the
required DTS definitions and pin control headers are present.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-12 16:57:17 -05:00
Daniel DeGrasse 0eedecca28 boards: pico_pi_m4: enable pin control
enable pin control for pico_pi_m4 board.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-12 16:57:17 -05:00
Daniel DeGrasse 5bc3cc97fc boards: mimx8mq_evk: enable pin control
Enable pin control for mimx8mq_evk board.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-12 16:57:17 -05:00
Daniel DeGrasse fd24d4f1ba boards: mimx8mp_evk: enable pin control
Enable pin control for mimx8mp_evk board

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-12 16:57:17 -05:00
Daniel DeGrasse 288870c812 boards: mimx8mm_evk: enable pin control
Enable pin control for mimx8mm_evk board.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-12 16:57:17 -05:00
Daniel DeGrasse 245a5aa5da boards: udoo_neo_full_m4: enable pin control
Add pin control support for udoo_neo_full_m4 board.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-12 16:57:17 -05:00
Daniel DeGrasse c35b6dec11 boards: warp7_m4: enable pin control
Enable pin control on warp7_m4 board.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-12 16:57:17 -05:00
Daniel DeGrasse ed44392a8e boards: colibri_imx7d_m4: enable pin control
Enable pin control on colibri_imx7d_m4 board.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-12 16:57:17 -05:00
Daniel DeGrasse 4edff13692 baords: 96b_meerkat96: enable pin control
Enable pin control on 96b_meerkbat96 board.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-12 16:57:17 -05: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 dea2e642b2 soc: mimx8ml8_m7: add pin control support for mimx8ml8_m7
Add pin control support for IOMUXC peripheral present
on mimx8ml8_m7 soc. This reuses the existing pin
control driver for the IOMUXC peripheral, but uses a
new header and compatible binding to handle the
different register layout on this SOC.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-12 16:57:17 -05:00
Daniel DeGrasse e1ef51ce39 soc: mimx8mm6_m4: add pin control support.
Add pin control support for mimx8mm6_m4 IOMUXC peripheral.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-12 16:57:17 -05:00
Daniel DeGrasse e3b4c0b314 soc: mimx8mq6_m4: add pin control support
Add pin control support for IOMUXC peripheral present
on mimx8mq6_m4 soc. This reuses the existing pin
control driver for the IOMUXC peripheral, but uses a
new header and compatible binding to handle the
different register layout on this SOC.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-12 16:57:17 -05:00
Daniel DeGrasse 5d374d7b29 soc: mcimx7_m4: add pin control support
Add pin control support for mcimx7_m4 SOC. This reuses the existing pin
control driver for the IOMUXC peripheral, but uses a new header and
compatible binding to handle the different register layout on this SOC.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-12 16:57:17 -05:00
Daniel DeGrasse e5fd7d8e67 soc: mcimx6x_m4 add pin control support
Add pin control support for mcimx6x. The IOMUXC peripheral present on
this SOC is identical to the one used on the iMX RT10xx series, so the
dts bindings are reused.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-12 16:57:17 -05:00
Daniel DeGrasse 25289d2759 boards: arm: add pin control groups for iMX application cores
Add pin control group definitions for all iMX application cores. This
commit does not enable pin control for any iMX cores, as the SOC level
support is not present, but does define the require pin mux settings for
all boards.

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
Flavio Ceolin 87b4759663 toolchain: xtensa: Define __sync_synchronize
This builtin gcc function is not available in xcc compiler.

Adding a memory compiler barrier as it is done in compiler_barrier.
compiler_barrier() and __sync_synchronize() are not the same, the
former is a sw barrier while the latter can be a hw barrier
like (mfence/sfence) in X86.

I didn't find anything equivalent for xtensa so just implementing a
SW barrier.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-05-12 16:11:39 -04:00
Francois Ramu ffa1532be2 samples: drivers flash add a test case for stm32 octospi
This add a new sample application to test and validate
the stm32 octospi driver on the NOR octo-flash present on
stm32 disco kits
There should be a special case to erase the complete flash.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-05-12 14:56:25 -05:00
Francois Ramu b4b7a782b6 boards: arm: stm32u5 disco kit target board has octo SPI instance
This commit enables the octo SPI peripheral to the flash-nor
on the target board b_u585i_iot02a from STMicroelectronics.
Note that JESD16 requires 9 dwords for the sdfp table.
The configuration is for OctoSPI bus through IO manager.
The NOR octoflash is MX25LM51245 or compatible.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-05-12 14:56:25 -05:00
Francois Ramu e76eac9f28 dts: arm: stm32u5 as a octospi node
Add the octospi nodes to the stm32u5 family

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-05-12 14:56:25 -05:00
Francois Ramu 1186636e2b boards: arm: stm32l562 disco kit target board has octo SPI instance
This commit enables the octo SPI peripheral to the flash-nor
on the target board stm32l562e_dk from STMicroelectronics.
Note that JESD16 requires 9 dwords for the sdfp table.
The NOR octoflash is MX25LM51245 or compatible.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-05-12 14:56:25 -05:00
Francois Ramu dcd13c07fc dts: arm: stm32l5 as a octospi node
Add the octospi node to the stm32l5 family

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-05-12 14:56:25 -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
Francois Ramu c16de1580f include: bindings: new bindings for the ospi flash controller
The new octoSPI flash controller driver
requires parameter to configure the peripheral
especially matching the data mode and the transfer rate

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-05-12 14:56:25 -05:00
Francois Ramu bb2cdc5966 module: Kconfig stm32 includes the DELAYBLOCK (DLYB)
add the config to support the DELAYBLOCK LL driver
for stm32 mcus like stm32U5x.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-05-12 14:56:25 -05:00
Francois Ramu 966fc20fe3 dts/bindings: introduce a new octospi devicetree
Add the DTS binding for OCTOSPI interface for the stm32 devices
from STMicroelectronics.
This corresponds to a NOR octo SPI flash.
In this config, there is only on NOR-flash device.

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
Stephanos Ioannidis 84089d30eb tests: sprintf: Fix incorrect message for 1234.56789 test
This commit fixes the test message showing an incorrect input value of
-1 when the actual input value is 1234.56789.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-05-12 15:26:29 -04:00
Daniel Leung 33e87270e4 tests: logging/log_msg2: add a missing test to suite
The test test_mode_size_str_with_strings() is defined but was not
added to the test suite, so it never ran before. Add this to
the suite so this can be tested.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-05-12 15:25:59 -04:00
Daniel Leung 52d0ed002c logging: missing func doc for param package_flags in log_msg2.h
This adds the missing "@param package_flags" for
z_log_msg2_runtime_create() and z_log_msg2_runtime_vcreate().

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-05-12 15:25:59 -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