- As described in datasheet, MSPM0L110x has 28 pins in GPIOA.
- Also, it does not contain GPIOB and GPIOC.
Signed-off-by: Ayush Singh <ayush@beagleboard.org>
The PCA series GPIO driver was updated to allow disabling automatic
reset. This feature would enable GPIO expander ports to retain states
which could be helpful for situations where certain pins are configured
in the bootloader and their states need to be retained when switching to
application code.
Signed-off-by: Lay Desai <lay.desai@he360.com>
This patch handles UULP GPIO configuration when the GPIO_INT_WAKEUP
flag is set. It allows the interrupt to wake the device from deep sleep.
The code has been tested by configuring UULP GPIO 2 (button_0) as a
wakeup interrupt on the siwx91x_rb4338a board.
Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
Rename BL61x GPIO and pinctrl drivers to bl61x_808 variants since
BL808 shares identical register layouts. Update compatible strings,
Kconfig, CMakeLists, and BL61x device tree accordingly. Extend the
DMA and IR receiver drivers' BL61x guards to also cover BL808.
Signed-off-by: William Markezana <william.markezana@gmail.com>
The `pinctrl_soc_pin_t` format occupied two uint32_t even though all info
it stores can be compressed in 32 bits only, and also didn't map very well
to the hardware (especially on STM32F1). Due to defects, the format was
also NOT what the `stm32_gpioport_configure_pin()` function consumed to
actually configure a GPIO port, requiring additional decoding/manipulation
logic.
Introduce a vastly reworked format which only requires 32-bit per pinctrl
entry and maps nicely to hardware and becomes the new format consumed by
stm32_gpioport_configure_pin(). This heavily simplifies the pinctrl driver
since it no longer needs to examine the actual values (except to determine
the target GPIO port and pin - this is done on purpose!). The GPIO driver
converts Zephyr flags to this new format too.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
Instead of silently ignoring the flags, warn the user when an illegal
GPIO configuration is provided on STM32F1. To avoid breaking backwards
compatibility and tests, the old behavior is however retained.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
Simplify the logic translating Zephyr GPIO flags into STM32-specific flags:
- flatten if chain for output type determination
- change how input modes are handled
- introduce new INPUT_FLOAT/INPUT_PUPD pincfg values which are used for
input mode depending on whether or not user requests pull-up/down
- these values can have the PULL_UP / PULL_DOWN OR'ed into them
- share PU/PD decoding between INPUT and OUTPUT mode
While at it, also return -ENOTSUP to caller if attempting to set a pull-up
or pull-down on a disabled pin instead of silently discarding the request.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
Move the logic which sets the output level based on configuration to the
common `stm32_gpioport_configure_pin()` function to reduce duplication.
To support the GPIO use case where a pin's configuration is changed without
modifying its output state, a new parameter is introduced which specifies
whether or not the output level should be modified.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
Add support for retrieving GPIO pin direction
when GPIO_GET_DIRECTION kconfig is enabled.
Signed-off-by: Muhammad Waleed Badar <muhammadx.waleedbadar@altera.com>
Add support for toggling a reset line during GPIO
initialization when a reset controller is available
in the device tree.
Signed-off-by: Muhammad Waleed Badar <muhammadx.waleedbadar@altera.com>
Replace direct register access using raw base addresses with
MMIO accessors to align with Zephyr DEVICE_MMIO API.
Use mem_addr_t for the base address and ensures compatibility with
architectures.
Signed-off-by: Muhammad Waleed Badar <muhammadx.waleedbadar@altera.com>
Realtek Bee series GPIO does not support configuring a pin as both
input and output simultaneously. Return -ENOTSUP to skip related
test cases.
Signed-off-by: Yuzhuo Liu <yuzhuo_liu@realsil.com.cn>
Add support for retrieving the direction of selected GPIO
pins. The it51xxx SoC does not support a combined
input-output mode, so return -ENOTSUP when such that mode
is requested.
Tested with:
- tests/drivers/gpio/gpio_hogs
- tests/drivers/gpio/gpio_get_direction
Signed-off-by: Ren Chen <Ren.Chen@ite.com.tw>
gpio_pin_is_valid() and gpio_pin_is_output_capable() use BIT() which
expands to (1UL << n). On 32-bit Xtensa targets, unsigned long is
32 bits, so BIT(n) for n >= 32 is undefined behavior.
This causes gpio1 pins (GPIO32+) to always fail validation with
-EINVAL, breaking any peripheral connected to GPIO32-GPIO48 on
ESP32-S3 (and similar ESP32 variants with gpio1).
Fix by using BIT64() which correctly handles pin numbers >= 32
since SOC_GPIO_VALID_GPIO_MASK is already a 64-bit value.
Signed-off-by: Matin Lotfaliei <matinlotfali@gmail.com>
Configuring a pin with GPIO_DISCONNECTED currently
results in the pin being set as output due to a
fallthrough in the code. This is not supported by
the driver and should return -ENOTSUP instead.
This commit ensures that configuring GPIO_DISCONNECTED
is explicitly rejected and not applied to the hardware.
Signed-off-by: Fabian Kainka <f.kainka@gmx.de>
Add hardware and software strategies to switch pins to low power
mode both in light and deep sleep. Add hold feature to device tree
flags to allow application to configure which pins will be
automatically held (pin state preserved) during sleep.
Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
The max149x6_config struct declared config_do/config_di with swapped
names, inverting semantics. Both fields are not yet used by the driver,
which is likely the reason why this went unnoticed.
Fixed by assigning each field its matching config union type.
Signed-off-by: Stan Verschuuren <stverschuuren@gmail.com>
max14916_pars_spi_diag() wrongly uses same mask as for MAX14906. On
4 channel MAX14906 SDO byte1 upper nibble is DoiLevel bits. On 8 channel
MAX14916, those are fault bits for channels 5-8.
Fixed by checking the full fault byte in the MAX14916 diagnostic parser.
Signed-off-by: Stan Verschuuren <stverschuuren@gmail.com>
MAX14916/915 defines GPIO channel specific DT properties, but the driver
does not apply them at init and programs zero values instead. Secondly, the
build test overlay for MAX14916 only sets 4 channels out of 8.
Fixed by initializing OW-on, OW-off, and short-to-VDD from DT during
config and setting the correct channel count in the test overlay.
Signed-off-by: Stan Verschuuren <stverschuuren@gmail.com>
gpio_max14916_config_diag() writes ow_on_en to wrong register
(OW_OFF_EN_REG instead of OW_ON_EN_REG).
Fixed by writing to correct register.
Signed-off-by: Stan Verschuuren <stverschuuren@gmail.com>
MAX14906/916 diagnostic helpers handle error propagation differently
across diag_chan_get(), pars_spi_diag(), and reg_trans_spi_diag(). This
creates asymmetry in parser/wrapper flows.
Additionally, the parser overwrites transport errors, obfuscating their
source.
Fixed by aligning helpers to standard errno-style return semantics and
failing fast consistently, propagating nested transport errors.
Signed-off-by: Stan Verschuuren <stverschuuren@gmail.com>
Both MAX14906/916 diag_chan_get paths keep previously cached channel fault
values when the corresponding interrupt bits are not set in later calls.
This leaves stale fault data such that diag_chan_get keeps reporting faults
after they have cleared.
Fixed by clearing fault caches before updating them from current interrupt
status.
Signed-off-by: Stan Verschuuren <stverschuuren@gmail.com>
Both MAX14906/916 pars_spi_diag paths can lose an captured FAULT1 error
when diag_chan_get() returns 0.
Fixed by only updating the parser return status when diag_chan_get()
returns nonzero.
Signed-off-by: Stan Verschuuren <stverschuuren@gmail.com>
max14906_ch_func(), gpio_max14906_config(), and gpio_max14916_config()
ignore return values from lower level register update/write helpers.
This leads to reports of successful pin configuration even when SPI
transactions fail.
Fixed by propagating the first error (effectively forwarding SPI errors)
to the caller, with no behaviour change in success path.
Signed-off-by: Stan Verschuuren <stverschuuren@gmail.com>
Several MAX14906/916/915 SPI write paths ignore MAX149xx_REG_WRITE()
return values and proceed silently after SPI write failures.
Fixed by propagating SPI write errors in the affected paths.
Signed-off-by: Stan Verschuuren <stverschuuren@gmail.com>
Several MAX14906/916/915 Read/ReadModifyWrite update paths use
MAX149xx_REG_READ() return values directly without validating SPI read
errors first. This leaves SPI read errors unnoticed and corrupts registers
by writing return values unconditionally.
Fixed by early returning on SPI read errors.
Signed-off-by: Stan Verschuuren <stverschuuren@gmail.com>
When max149x6_reg_transceive is called with rw=WRITE and rx_diag_buff=NULL,
the SPI diagnostic response byte is returned instead of 0, even though the
write was proper and successful.
Fixed by restricting the offending branch to READ only.
Signed-off-by: Stan Verschuuren <stverschuuren@gmail.com>
Extend the ESP32 GPIO driver to support ESP32-C5 by adding the
SoC series to the register struct compatibility defines.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
Disable the interrupt before reconfiguring its type to prevent
spurious triggers and edge detector asymmetry. Without this, the
first gpio_pin_interrupt_configure(GPIO_INT_EDGE_BOTH) can leave
the edge detector in an inconsistent state causing a persistent
timing offset between rising and falling edge detection.
Also skip the enable call when the requested mode is disable,
avoiding a redundant enable immediately after setting the type to
GPIO_INTR_DISABLE.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
ISR bits are set on input level or edge changes, regardless of whether an
interrupt is actually enabled on that line. Therefore, we check whether an
interrupt is actually enabled by masking with IMR. If we didn't do this,
some other enabled interrupt firing could also result in a callback for a
disabled interrupt.
Signed-off-by: Bert Abrath <bert.abrath@basalte.be>
The RX GPIO was originally develop for RX130 MCU which only have port
0 to 5 and A to J, this commit add missing port initialize for other RX
MCU family
Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
Apply PINCTRL_STATE_SLEEP on suspend and PINCTRL_STATE_DEFAULT on resume
to ensure pins take on the DTS defined sleep state if one is defined.
TURN_ON already applies PINCTRL_STATE_DEFAULT (could be removed
potentially). RESUME handles the case where the device suspends without
full power-off.
Signed-off-by: Jacob Wienecke <jacob.wienecke@nxp.com>
For Cortex-A Core, Zephyr runs on non-secure world, the bit in PCNS
or ICNS for corresponding GPIO pin is 1, no need to clear it and
Cortex-A Core could access the corresponding pin's regitsters, so
disable this feature for Cortex-A Core.
Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
The pcf857x_port_set_raw() function has a race condition where
the lock is only taken after the I2C write to update the cached
outputs_state. This allows concurrent threads to read stale
outputs_state values and compute tx_buf based on outdated data.
Since PCF8574/PCF8575 devices have a single output register that
is written atomically (all pins at once), a stale read causes one
thread's pin changes to be overwritten by another thread's write.
Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
The `gpio_stm32_configure()` function is used by both the GPIO and PINCTRL
drivers to configure I/O pins. Move it to the GPIO port manager module's
code so it can be shared properly and update both drivers accordingly.
With this change, the GPIO and PINCTRL drivers are completely decoupled.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
On STM32 hardware, the GPIO port's MMIO interface is used for two purposes
which have their own separate Zephyr API: controlling the state of digital
I/O pins directly (GPIO API) and configuring I/O pins for a specific usage
(PINCTRL API). Historically, this was handled by having the PINCTRL driver
call inside the GPIO driver which works but creates a dependency loop.
Introduce a new `GPIO port manager` module in SoC-specific common code that
takes over various from the existing GPIO/PINCTRL drivers: GPIO port device
instantiation and `GPIO port index -> device` mapping respectively.
Modify the GPIO and PINCTRL drivers to make use of this GPIO port manager
module - a first step in decoupling both drivers from each other.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
Move the helper function which computes the LL pin value from a pin number
to the <stm32_gpio_shared.h> header as this function can be useful for
modules other than the GPIO driver.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
Move the ports list from the GPIO driver to a shared SoC-specific header.
This will allow reuse from other drivers such as pinctrl.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
The function is only used from the device's PM action and is very trivial.
Inline it inside gpio_stm32_pm_action to simplify the driver.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
The STM32 pinctrl dt-bindings headers were full of definitions used by the
SoC-specific pinctrl header (<pinctrl_soc.h>) rather than from Devicetree.
Move these definitions to the appropriate header. While at it, include the
<pinctrl_soc.h> header from GPIO driver instead of series-specific pinctrl
header since it uses these definitions.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
Adapt all Espressif SoC and driver code to the updated
hal_espressif module synced with IDF master branch.
Main changes:
- clock control: delegate peripheral clock gating to HAL
layer using new clock/reset APIs
- SPI/GDMA: adapt to restructured DMA HAL with new channel
allocation and configuration interfaces
- ethernet: add RMII clock configuration and PHY management
- GPIO: simplify using direct HAL function calls
- flash: adapt to updated SPI flash HAL interfaces
- linker scripts: update IRAM/DRAM mappings for new HAL
object files
- DTS: fix ESP32-S2 PSRAM dcache1 address to match actual
MMU mapping region (0x3f800000 DRAM1 instead of 0x3f500000
DPORT which lacks 8-bit access capability)
- west.yml: update hal_espressif revision
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
Add a GPIO driver for the Infineon CYW43439 WiFi chip that exposes
WL_GPIO0-2 as standard Zephyr GPIO pins. Pin 0 is the onboard LED
on Raspberry Pi Pico W and Pico 2 W boards.
The GPIO node is a child of the AIROC WiFi device node in the
devicetree. GPIO control is performed via the WHD gpioout iovar,
serialized with a mutex. A shadow register tracks pin state since
the CYW43439 does not support GPIO readback.
Signed-off-by: John Lin <mcjelcom@gmail.com>
Remove instance specific Kconfigs (CONFIG_NRFX_GPIOTEx) as they are no
longer used. Cleanup in all places.
Add prompt to CONFIG_NRFX_GPIOTE to allow enabling the driver.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>