Commit graph

236 commits

Author SHA1 Message Date
Manuel Arguelles 7319ba11f7 boards: arm: mr_canhubk3: add support for GPIO
Add GPIO support for mr_canhubk3 board and enable GPIO tests.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-07-06 14:19:23 -05:00
cyliang tw 0fd564ef7f drivers: gpio: support for Nuvoton numaker series GPIO
Add Nuvoton numaker series GPIO support, including interrupt mode and
also integrate clock control.

Signed-off-by: cyliang tw <cyliang@nuvoton.com>
2023-06-21 09:26:00 +00:00
Manimaran A 79ee5a876f drivers: gpio: Microchip MEC172x GPIO driver glitch fix
A glitch was observed if a GPIO PIN was configured to a
non-default state by ROM and then Zephyr programs the pin
for the same configuration. Root cause is GPIO hardware
implementing two output bits for each pin. The alternate
output bit is in the pin control register and is r/w by
default. The other bit exists in the GPIO parallel ouput
register and is read-only by default. The hardware actually
reflects the pin's output value into both bits. The fix is
to configure the pin with alternate output bit read-write
and the last step is to disable alternate output which
enabled read-write of the parallel bit. GPIO API's can
then use the GPIO parallel out registers. Add logic to
return an error from the GPIO interrupt configure API if
a pin is not configured as an input. Hardware only performs
interrupt detection if the input pad is enabled.
Hardware supports a pin being configured for both input
and output. Applications should add the GPIO_INPUT flag
to all pin configuration requiring interrupt detection.
The interpretation of input and output flags for the
get configuration API appears to be only one of the
flags can be set. Please refer to the GPIO driver tests.
Updated GPIO interrupt configure to clear the input pad
disable bit due to interrupt detection HW is connected
only to input side of pin.

Signed-off-by: Manimaran A <manimaran.a@microchip.com>
2023-05-16 18:52:44 -04:00
Gerard Marull-Paretas 93b63df762 samples, tests: convert string-based twister lists to YAML lists
Twister now supports using YAML lists for all fields that were written
as space-separated lists. Used twister_to_list.py script. Some artifacts
on string length are due to how ruamel dumps content.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-10 09:52:37 +02:00
Anas Nashif 326eb860b8 tests: gpio: be consistent with id across all drivers
change id from peripheral.gpio to drivers.gpio.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-04-19 08:57:57 -04:00
Tim Lin bcb173becd tests: drivers: Unit test for it82xx2_evb board
The below is the unit test result for the driver and kernel of
it82xx2_evb board.

GPIO/gpio_basic_api: PASS
I2C/i2c_api: PASS
Flash: PASS
UART/uart_basic_api: PASS
PWM/pwm_api: PASS
WDT/wdt_basic_api: PASS
KSCAN/kscan_api: PASS
kernel/sched/schedule_api: PASS
kernel/sched/preempt: PASS
kernel/timer/timer_api: PASS
kernel/sleep: PASS
ADC/adc_api: PASS.
ADC note: conversion time~=61.6us
          sample time delay~=60us
          wait voltage stable time~=202.8us
Set sampling time to 500us will pass for ADC test.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2023-04-19 03:48:38 -04:00
Sung-Chi Li d455b6dee0 tests: drivers: gpio: Add test for GPIO_ENABLE_DISABLE_INTERRUPT
Add test for the experimental feature GPIO_ENABLE_DISABLE_INTERRUPT,
which covers APIs gpio_pin_interrupt_enable() and
gpio_pin_interrupt_disable().

Signed-off-by: Sung-Chi Li <lschyi@google.com>
2023-04-06 11:44:07 -04:00
Lucas Tamborrino 0727cacd88 tests: drivers: gpio_basic_api: add overlays for esp32s2/c3/s3
Add support for the following boards:
- esp32s2_saola
- esp32c3_devkitm
- esp32s3_devkitm

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-03-23 17:32:54 -04:00
Fabio Baltieri 2815f96440 drivers: move gpio_keys from gpio to input
Port the gpio_keys_zephyr driver from the gpio subsystem with a
dedicated API to the input subsystem reporting input events.

Move the test as well, simplify the cases a bit since the API is simpler
now.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-03-14 17:15:09 -04:00
Jay Vasanth e56721b8f0 dts: gpio: Add Microchip XEC GPIO macros for use in device tree
Microchip XEC devices specify GPIO pin using octal numbering and
organize pins in banks of 32. Chip documentation does not use
bank naming rather naming each pin by its octal number. This has
led to the developer having to calculate the bit position of a pin
in its 32-bit bank when a specifying the pin for GPIO usage. We
created a set of defines for all possible GPIO pins that specify
the DT GPIO bank name used in the chip level DTSI files and the
bit position in that bank.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2023-03-02 13:52:03 +01:00
Gerard Marull-Paretas 49123a97f0 tests: drivers: gpio: basic_api: remove unused pinmux.h include
The test was not using the pinmux.h API.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-23 16:56:04 -05:00
Keith Short 51bd9dad96 tests: gpio_hogs: Fix the output low test
The output low test was checking the wrong GPIO spec handle.

Signed-off-by: Keith Short <keithshort@google.com>
2023-02-08 11:08:00 +01:00
Henrik Brix Andersen 8d4c6b96c4 tests: drivers: gpio: add GPIO hogs test
Add test of the GPIO hog functionality using the optional GPIO APIs for
getting pin direction and configuration.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-27 14:38:52 -08:00
Andrzej Głąbek b4fb5300da boards: nrf52840dk_nrf52840: Do not enable arduino_serial by default
This is a follow-up to commit 25d7a09aa5.

The arduino_serial/uart1 node should not be enabled by default because
even if an application does not use it, the default CONFIG_SERIAL=y
setting causes that it is anyway initialized, so the UARTE peripheral
acquires its assigned pins (and they cannot be used in other way) and
its enabled receiver causes increased current consumption (by ~500 uA)
when the CPU is sleeping. This affects e.g. the boards/nrf/system_off
sample.
Applications that actually need to use this UART or shields that use
the arduino_serial node should enable the node explicitly.

Keep this node disabled by default for the nrf52840dk_nrf52840 board
and also for boards whose definitions are mostly copies of the above:
nrf52833dk_nrf52833 and nrf21540dk_nrf52840.

Update also accordingly a few overlay files in tests/ that were
disabling this node because of the pins it undesirably acquired.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-01-16 09:26:10 +01:00
Fabio Baltieri f5b4acac57 yamllint: indentation: fix files in tests/
Fix the YAML files indentation for files in tests/.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-01-04 14:23:53 +01:00
Al Semjonovs a072236583 gpio: Add tests for software based GPIO debounce driver
Add tests to validate software based GPIO debounce driver.

Signed-off-by: Al Semjonovs <asemjonovs@google.com>
2023-01-04 10:36:00 +01:00
Gerard Marull-Paretas 327f3ed25d tests: drivers: gpio: remove deprecated GPIO_VOLTAGE_MASK
The macro has been deprecated and about to be removed. Since there are
no in-tree usages, it is safe to ignore/remove it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-11 11:00:26 +01:00
Dat Nguyen Duy 8db84cfa6a tests: drivers: gpio_api_1pin: support GPIO interrupt tests for NXP S32Z27
add support GPIO input interrupt tests for NXP S32Z27

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2022-11-04 17:44:08 -04:00
Dat Nguyen Duy 1db8419868 tests: drivers: gpio_basic_api: support to run the test on NXP S32Z27
Add support to run the test on NXP S32Z27, the wiring connection
is needed as describe in overlay file

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2022-11-04 17:44:08 -04:00
Manuel Arguelles 2c62966621 tests: gpio: add overlays for s32z270dc2_r52 boards
Enable testing of GPIO driver minimal API's on s32z270dc2_r52 boards.
These boards do not have built-in user LED, therefore a GPIO pin is used
instead.

Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2022-10-14 09:51:14 +02:00
Enjia Mai 4c9faf95ef tests: driver: gpio: fix the incorrect testsuite names
There are some erros in previous ztest API migration of
the gpio_basic_api tests. Fix the incorrect testsuite
name of the callback mgmt and vari tests.

Fixes: #49953

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-09-19 09:34:36 +00:00
Hu Zhenyu 99ab3fba54 tests: Change the result compare method in pin_get_config()
Fixes #47921
When setting a GPIO to certain value, and then get the GPIO value, on some
platforms, such as ITE, these two values may not be the same. For example
setting GPIO_OUTPUT | GPIO_OUTPUT_INT_HIGH, it will read back
GPIO_OUTPUT | GPIO_OUTPUT_INT_HIGH | GPIO_VOLTAGE_3P3. This is as expected,
as GPIO_VOLTAGE is a read only property. So when comparing the gpio set
and get values, it is necessary to filter the read only bits first and
then compare to the set value.

Signed-off-by: Hu Zhenyu <zhenyu.hu@intel.com>
2022-09-07 15:34:28 +02: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
Hu Zhenyu 202b2ff91f tests: gpio: add initial state of GPIO set bits
When a GPIO is 1 and port_set_bits_raw_and_verify function does
not set that bit, it will still be 1. So calculate the expected
value only by the parameter of port_set_bits_raw_and_verify is
not enough. A proper way is to clear all the GPIO bit fist and
then do the test.
Fixes: #49714

Signed-off-by: Hu Zhenyu <zhenyu.hu@intel.com>
2022-08-31 18:49:07 -04:00
Enjia Mai 59884f3b88 tests: drivers: gpio: move the gpio 1pin test to new ztest API
Migrate the testsuite tests/drivers/gpio/gpio_api_1pin to the
new ztest API.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-08-29 10:31:45 +02:00
Enjia Mai 59422fdff7 tests: drivers: gpio: move the gpio basic test to new ztest API
Migrate the testsuite tests/drivers/gpio/gpio_basic_api to the new
ztest API.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-08-29 10:31:45 +02: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 664a8d3d24 tests: drivers: gpio: initialize device at compile time
Initialize device 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
Francois Ramu dd8cb23213 tests: drivers: gpio basic pass testcase when test pin_get is not defined
When the CONFIG_GPIO_GET_CONFIG is set, even if the driver does not
provide the pin_get_config function, it is supposed to return -ENOSYS
error code (see zephyr/include/zephyr/drivers/gpio.h)
The testcase should accept this code and PASS.
(ENOTSUP is not the right value to check).

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-08-12 14:13:37 +01:00
Henrik Brix Andersen b0c4b399f9 tests: drivers: gpio: gpio_basic_api: remove rv32m1 pinmux calls
Remove the calls to configure the pinmux for GPIO for the RV32M1. These are
no longer needed after 9ba953d13a.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-08-11 18:39:17 -05:00
Andriy Gelman 9f77926b26 tests: gpio_api_1pin: Test interrupt re-entry if level unchanged
Currently the level triggered test disables the interrupt in
the first callback. This doesn't test interrupt re-entry if the
gpio level is unchanged.

This commit adds an option to disable the interrupt after
several calls and adds two tests with the extra condition.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-08-03 11:19:35 +02:00
Fabio Baltieri def230187b test: fix more legacy #include paths
Add a bunch of missing "zephyr/" prefixes to #include statements in
various test and test framework files.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-02 16:41:41 +01:00
Kumar Gala 2c990384d6 tests: Remove label property from devicetree overlays
"label" properties are not required.  Remove them from tests.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-28 20:52:20 +02:00
Kumar Gala 1c1c57b31b gpio: remove defconfig/proj setting of GPIO drivers
Now that gpio drivers are enabled based on devicetree we can remove
any cases of them getting enabled by *defconfig and proj.conf files.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-26 08:49:38 +02:00
Alexandre Bourdiol 8bfc215bef tests: drivers: gpio: gpio_basic_api: use static dev declaration
"dev" is already defined as a static variable,
it should not be redefined locally
Fix regression introduced by commit
2a8e3fe82d

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2022-07-13 10:14:53 +02:00
Michał Barnaś ad73b1d876 gpio: add test for pin_get_config function
This commit adds test for pin_get_config function.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-07-12 19:19:09 +02:00
Kumar Gala 2a8e3fe82d tests: gpio_basic_api: Convert test to use DEVICE_DT_GET
Move to use DEVICE_DT_GET instead of device_get_binding as
we work on phasing out use of DTS 'label' property.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-08 09:26:30 -05:00
Kumar Gala 1f82e32518 tests: gpio-api-1pin: Convert test to use DEVICE_DT_GET
Move to use DEVICE_DT_GET instead of device_get_binding as
we work on phasing out use of DTS 'label' property.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-08 09:26:30 -05:00
Kumar Gala b9940d5988 tests: gpio_get_direction: Convert to use DEVICE_DT_GET
Move to use DEVICE_DT_GET instead of device_get_binding as
we work on phasing out use of DTS 'label' property.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-07 15:13:36 +02:00
Francois Ramu 209c75ca19 tests: drivers: gpio on nucleo_g071rb new pins
This commit changes the pin assignment for the gpio_basic_api
test case because A0 was conflicting with the testcase
tests/drivers/dac/dac_loopback.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-07-07 10:28:23 +00:00
Christopher Friedt 283ecc1ded tests: drivers: gpio: direction: use new ztest api
Adjust suite to use new ztest API.

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-07-02 07:07:11 -04:00
Christopher Friedt e46afe75ca tests: drivers: gpio: skip unsupported tests / drivers
Some drivers may not support simultaneous input-output
configuration or disconnect.

In such cases, the driver should return `-ENOTSUP` and the
test should be skipped.

Fixes #46917

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-07-02 07:07:11 -04:00
Christopher Friedt 165c5db078 tests: drivers: gpio: tests for gpio_port_get_direction
Tests for 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
Yinfang Wang 4278d69924 test: Enable the GPIO tests on EHL_CRB.
Enable testcases under tests/drivers/gpio/gpio_basic_api
To run in twister, "-X gpio_loopback" parameter is needed.

Signed-off-by: Yinfang Wang <yinfang.wang@intel.com>
2022-06-21 10:47:56 +02:00
Hu Zhenyu 312ed2526f test: Enable the GPIO tests on mec172xevb_assy6906
Enable testcases under tests/drivers/gpio/gpio_basic_api
To run in twister, "-X gpio_loopback" parameter is needed

Signed-off-by: Hu Zhenyu <zhenyu.hu@intel.com>
2022-06-05 14:47:21 +02:00
Gerard Marull-Paretas ade7ccb918 tests: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all tests 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 20:02:14 +02:00
Daniel DeGrasse 1b39e2ff13 tests: drivers: gpio: Remove pinmux setting on lpc for gpio_basic_api
LPC gpio driver now supports pinmux setting in gpio_pin_configure, so
remove the pinmux workaround for this platform in gpio_basic_api test.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-06 20:57:22 -07: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
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
Erwan Gouriou 6a6c47b619 tests/drivers: gpio_basic_api: Add overlay to test nucleo_wl55jc
Add and overlay to enable gpio api test on this board.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-01-31 14:37:11 -06:00
Gerard Marull-Paretas 97cc216957 tests: drivers: gpio: gpio_basic_api: add support for gd32vf103v_eval
Add DT overlay to run gpio_basic_api test on GD32VF103V-EVAL board. In
order to make testing easy a couple of accessible pins have been
selected: PD0 and PD1 pins exposed via JP13 and JP4 respectively.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-01-11 11:50:35 +01:00
Jordan Yates d336954d1c tests: remove manual CONFIG_GPIO_EMUL
Remove the manual selection of `CONFIG_GPIO_EMUL` as it is now enabled
by default when devicetree nodes exist.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-01-06 11:56:15 -05:00
Dino Li e79b6f1a81 tests: drivers: gpio: basic: add it8xxx2_evb test configuration
Add basic GPIO API test configuration for the IT8XXX2.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-01-05 14:57:54 -05:00
Gerard Marull-Paretas 38d583bbf4 tests: drivers: gpio: gpio_basic_api: add support for gd32f403z_eval
Add DT overlay to run gpio_basic_api test on GD32F403Z-EVAL board. In
order to make testing easy a couple of accessible pins have been
selected: PD0 and PD1 pins exposed via P3 and P2 respectively.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-01-04 20:49:00 -05:00
Gerard Marull-Paretas 3bf7a7a326 tests: drivers: gpio: gpio_basic_api: add support for gd32f450i_eval
Add DT overlay to run gpio_basic_api test on GD32F450I-EVAL board. In
order to make testing easy a couple of accessible pins have been
selected: PC6 and PC7, the last 2 pins on the DCI camera 2.54" header.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-01-04 20:49:00 -05:00
Krzysztof Chruscinski d65654518f tests: drivers: gpio: gpio_basic_api: nrf: Extend test
Extend test configuration for nrf52840dk to validate use of
GPIO SENSE and GPIOTE IN event for edge interrupts.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-12-22 12:03:00 +01:00
Henrik Brix Andersen 3091bddafa tests: drivers: gpio: 1pin: exclude neorv32
The GPIO block of the NEORV32 contains fully independent inputs and
outputs (inputN is fully independent of outputN).

This scenario is not handled by the 1pin GPIO test case, so exclude the
neorv32 for now.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-10-15 09:46:53 -04:00
Henrik Brix Andersen 296ba9a7d0 tests: drivers: gpio: basic: add neorv32 test configuration
Add basic GPIO API test configuration for the NEORV32.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-10-15 09:46:53 -04:00
Erwan Gouriou 921a3d8543 tests/drivers: gpio_basic_api: Upudate nucleo_f103rb configuration
For some reason, provided pin configuration for nucleo_f103rb
is not able to detect gpio callback issues.
Move to other pin combination which detect pin callback issues.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-09-28 06:19:08 -04:00
Jim Shu f9726c9186 boards: riscv: add initial support of adp_xc7k_ae350 board
Adding adp_xc7k_ae350 board support based on andes_ae350 soc. It's base
support and only contains uart/gpio drivers.

Signed-off-by: Jim Shu <cwshu@andestech.com>
2021-08-30 13:40:14 -04:00
Torsten Rasmussen 1cccc8a8fe cmake: increase minimal required version to 3.20.0
Move to CMake 3.20.0.

At the Toolchain WG it was decided to move to CMake 3.20.0.

The main reason for increasing CMake version is better toolchain
support.

Better toolchain support is added in the following CMake versions:
- armclang, CMake 3.15
- Intel oneAPI, CMake 3.20
- IAR, CMake 3.15 and 3.20

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-08-20 09:47:34 +02:00
Martí Bolívar 682aea8b3b dts: don't use 'test' vendor prefix
This is now failing an edtlib check for unknown vendor prefixes.

I can't find a reason to use a vendor prefix in application-local
bindings like this, so just remove it wherever it appears by
normalizing to test-foo-compat instead of test,foo_compat or
test,foo-compat.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-19 08:05:04 -05:00
Kieran Mackey 081c2f801f boards: add pca953x to bl5340_dvk
Adding pca953x and attached pins to board dts file

Signed-off-by: Kieran Mackey <kieran.mackey@lairdconnect.com>
2021-07-31 14:56:34 -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
Mulin Chao cfbd9ea437 board: npcx: add npcx9m6f_evb board.
Introduce the npcx9m6f_evb board driver. NPCX9M6F_EVB board is a
development platform to evaluate the Nuvoton NPCX9 series
microcontrollers. This board needs to be mated with part number
NPCX996F.

It also includes:
 1. Add CONFIG_BOARD_NPCX9M6F_EVB definition for adc test suite.
 2. Add npcx7m6f_evb.overlay file for gpio test suite.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-06-08 00:40:14 -04:00
Erwan Gouriou 125d82a84c tests/drivers: gpio: Add support for stm32l562e_dk
Required for board testing


Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-05-06 14:31:13 -04:00
Kumar Gala 6b8fa2a85e arm: nxp: kinetis: Remove explicity setting of pincfg to GPIO
Remove board code and a few associated samples/tests that explicitly
call pinmux_pin_set() to set a given pin as GPIO.  This is handled as
part of gpio_mcux_configure() so we don't need to do it again.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-04-15 12:25:05 +02:00
Jan Kowalewski 5db06d6380 tests: drivers: gpio: provide quickfeather overlay
This commit provides the necessary overlay to make the test pass
on the QuickFeather hardware.

Signed-off-by: Jan Kowalewski <jkowalewski@antmicro.com>
2021-03-11 08:58:20 -05:00
Martí Bolívar 51f55b437f twister: replace dt_compat_enabled_with_alias filter
Originally added in 7733b94224.

This filter is not well-formed. It's meant to match nodes like
/leds/led_0 in this DTS:

/ {
	aliases {
		led0 = &led0;
	};

	leds {
		compatible = "gpio-leds";
		led0: led_0 {
			gpios = <...>;
			label = "LED 0";
		};
	};
};

Uses look like this:

    filter: dt_compat_enabled_with_alias("gpio-leds", "led0")

But notice how the led_0 node doesn't have compatible "gpio-leds";
it's actually the *parent* node that has that compatible.

Replace this with a new filter, dt_enabled_alias_with_parent_compat(),
which is used like this:

    filter: dt_enabled_alias_with_parent_compat("led0", "gpio-leds")

This has a name and argument order that makes the meaning of the
filter clearer.

Replace in-tree users with the new filter.

Deprecate the old filter and warn about its use using the standard
logging module.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-03-10 15:09:09 -05:00
Kumar Gala 263ac3e9e5 drivers: pinmux: mcux_lpc: Convert to using devicetree
Convert driver and users of pinmux on mcux lpc platforms to getting
basic port info from devicetree (register address, label)

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-01 12:04:53 -06:00
Christopher Friedt c313828eaf tests: gpio_api_1pin: support for emulated GPIO
This adds support for emulated GPIO (CONFIG_GPIO_EMUL=y) and
additionally allows BOARD=native_posix and
BOARD=native_posix_64 to run the gpio_api_1pin test suite.

Fixes #26477

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-12-27 18:15:33 +01:00
Christopher Friedt cc537b5a3a tests: gpio_basic_api: support for emulated GPIO
This adds support for emmulated GPIO (CONFIG_GPIO_EMUL=y) and
additionally allows BOARD=native_posix and
BOARD=native_posix_64 to run the gpio_basic_api test suite.

Fixes #26477

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-12-27 18:15:33 +01:00
Andrei Gansari b66db222a2 tests: gpio: gpio_port_set_masked_raw overwrite check
Code checks if gpio_port_set_masked_raw overwrites masked pins.
It should detect that the attempt to set only the input pin to zero also
affected the output pin.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2020-10-14 15:21:34 -05:00
Peter Bigot ab647ae74c tests: gpio_api_1pin: fix failing test on reel_board
Need to add a rise/fall delay after configuring the pin as an input,
due to a long RC time constant on LED1 circuit.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-09-09 15:12:11 +02:00
Tomasz Bursztyka e18fcbba5a device: Const-ify all device driver instance pointers
Now that device_api attribute is unmodified at runtime, as well as all
the other attributes, it is possible to switch all device driver
instance to be constant.

A coccinelle rule is used for this:

@r_const_dev_1
  disable optional_qualifier
@
@@
-struct device *
+const struct device *

@r_const_dev_2
 disable optional_qualifier
@
@@
-struct device * const
+const struct device *

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Mulin Chao 6deb68a517 driver: gpio: add gpio driver support in NPCX series
Add gpio support for Nuvoton NPCX series. This CL includes:

1. Add GPIO device tree declarations.
2. Introduce wui_maps property in yaml file to present relationship
   between Wake-Up
   Input (WUI) and 8 IOs belong to the device.
3. Zephyr GPIO api implementation.
4. GPIO callback functions implementation with MIWU api functions.
5. Overlay file for gpio basic tests

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-09-01 13:35:25 +02:00
Peter Bigot 0b286d7304 samples: remove unnecessary check for flags cell in gpios
The devicetree helper macro now provides zero when the cell is not
present.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-08-27 15:59:03 +02:00
Peter Bigot bf04c61f6e tests: gpio_basic_api: disconnect output in initial setup
One driver (mchp_xec) appears to have problems with setting the output
value before setting the direction, which can be caught if the order
of checks in the port setup function are reversed.  Reconfigure the
output to a non-output state before the second test to see if that
catches the problem.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-08-19 19:18:43 -04:00
Mahesh Mahadevan 47a00423ac MXRT600: Add support to run Basic GPIO test
Use Arduino pins A0 and A1

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2020-08-19 13:06:30 -05:00
Alexandre Bourdiol 4f34d90c8c tests: drivers: gpio: gpio_basic_api: add some STM32 boards overlay
Add overlay for boards:
* nucleo_f429zi
* nucleo_g474re
* nucleo_l152re
* nucleo_l4r5zi
* stm32f3_disco
* nucleo_f091rc
* nucleo_l073rz

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-08-14 18:07:06 +02:00
Anas Nashif 0798b85d1c tests: remove obsolete doxygen boilerplate
An old doxygen biolerplate was being copied all over the tests. The
defined groups are not being used anywhere and it does not follow how we
document tests for example in the kernel and other places.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-07-28 08:14:23 -05:00
Piotr Mienkowski 4b194eb4fc gpio: remove deprecated API functions/macros
This commit removes API functions and macros which were deprecated in
2.2 release. GPIO drivers are updated accordingly.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2020-06-16 19:13:05 +02:00
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Peter Bigot 394ff7a28b tests: drivers: gpio_basic_api: silence Coverity warning
The tests normally verify that pin configuration succeeded by checking
the return value.  That's not necessary on the cleanup path, so
expressly ignore the result.

Also lift the common code to before the exit branching.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-01 21:59:17 +02:00
Marc Herbert debade9121 tests: make find_package(Zephyr...) REQUIRED
... because it is (required).

This makes a difference when building with CMake and forgetting
ZEPHYR_BASE or not registering Zephyr in the CMake package registry.

In this particular case, REQUIRED turns this harmless looking log
statement:

-- Could NOT find Zephyr (missing: Zephyr_DIR)
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- ...
-- ...
-- ...
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:8 (target_sources):
  Cannot specify sources for target "app" which is not built by
  this project.

... into this louder, clearer, faster and (last but not least) final
error:

CMake Error at CMakeLists.txt:5 (find_package):
  Could not find a package configuration file provided by "Zephyr" with
  any of the following names:

    ZephyrConfig.cmake
    zephyr-config.cmake

  Add the installation prefix of "Zephyr" to CMAKE_PREFIX_PATH or set
  "Zephyr_DIR" to a directory containing one of the above files.  If
  "Zephyr" provides a separate development package or SDK, be sure it
  has been installed.

-- Configuring incomplete, errors occurred!

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-05-29 10:47:25 +02:00
Anas Nashif 0c908e124e tests: gpio_basic: this test requires a fixture
This test requires a fixture to be installed, in this case a wire
connecting two GPIO pins.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-24 20:25:51 +02:00
Alexandre Bourdiol 2f8167fc08 test: drivers: gpio: gpio_basic_api: disable interrupt at end of test
When switching from rising edge to falling edge of test:
test_gpio_deprecated(),
because exti callback is already configured (from rising edge test),
the pin configuration abort for EBUSY reason.
It is necessary to disable interrupt,
so that next test will start with clean configuration.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-05-18 19:12:46 +02:00
Daniel Leung 01445ef873 tests: gpio_basic_api: change GPIOs for mec15xxevb_assy6853
GPIO 050/051 are being used for tachometer sensor as
CONFIG_TACH_XEC is enabled by default. So for the gpio_basic_api
test, another set of GPIOs are needed. GPIO 156/157 are chosen
as they are (more or less) dedicated for two LEDs on board and
not being used for other functions (pinmux-wise).

Fixes #25272

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-05-15 17:18:41 +02:00
Martí Bolívar 6e8775ff84 devicetree: remove DT_HAS_NODE_STATUS_OKAY
Several reviewers agreed that DT_HAS_NODE_STATUS_OKAY(...) was an
undesirable API for the following reasons:

- it's inconsistent with the rest of the DT_NODE_HAS_FOO names
- DT_NODE_HAS_FOO_BAR_BAZ(node) was agreed upon as a shorthand
  for macros which are equivalent to
  DT_NODE_HAS_FOO(node) && DT_NODE_HAS_BAR(node) &&
- DT_NODE_HAS_BAZ(node), and DT_HAS_NODE_STATUS_OKAY is an odd duck
- DT_NODE_HAS_STATUS(..., okay) was viewed as more readable anyway
- it is seen as a somewhat aesthetically challenged name

Replace all users with DT_NODE_HAS_STATUS(..., okay), which is
semantically equivalent.

This is mostly done with sed, but a few remaining cases were done by
hand, along with whitespace, docs, and comment changes. These special
cases include the Nordic SOC static assert files.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-13 18:24:42 +02:00
Kumar Gala fdd85d5ad7 dts: Rename DT_HAS_NODE macro to DT_HAS_NODE_STATUS_OKAY
Rename DT_HAS_NODE to DT_HAS_NODE_STATUS_OKAY so the semantics are
clear.  As going forward DT_HAS_NODE will report if a NODE exists
regardless of its status.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-06 05:25:41 -05:00
Anas Nashif 5677eb0a35 tests: gpio: remove unused harness
harness being set without actual use of harness (via harness_config)
makes the test behave differently.

Fixes #24661

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-05 06:16:50 -04:00
Kumar Gala 59d3cc213e tests: Convert DT_ALItAS_* to new DT_ALIAS() macro
Convert DT_ALIAS_* defines to use DT_ALIAS() plus other macros from
include/devicetree.h.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-04 09:11:38 -05:00
Daniel Leung 13ef99831a drivers: gpio: mchp_xec: Convert to using new device tree macros
Convert driver to use the new device tree macro's instead of
dts_fixup.h based macros. This moves us closer to removing both
dts_fixup.h and per instance Kconfig symbols.

The pinmux_mchp_xec is also being updated since it's using DT
from GPIO.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-04-28 07:43:31 -05:00
Peter Bigot 6c674300fc tests: drivers: gpio: add SX1509B interrupt-supporting configs
No in-tree boards support the NINT signal on an SX1509B IO extender,
so test using custom overlays/configurations for the Particle Xenon
board using an SX1509B breakout board.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-04-20 18:51:59 +02:00
Peter Bigot 033cb11db2 tests/drivers/gpio: fix nrf52840dk_nrf52840 overlay
Changes to Kconfig vs devicetree resulted in uart1 being enabled,
which steals the test pins away from the test.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-04-20 15:33:14 +02:00
Kumar Gala 8f0018663f drivers: pinmux: rv32m1: Convert driver to new DT_INST macros
Convert driver to use DT_INST macros and remove related board per
instance Kconfig symbol usage.

Updated the openisa,rv32m1_vega-pinmux binding to require the label
property and updated the rv32m1.dtsi to add label properties for the
pinmux nodes.

Also update gpio_basic_api test to use DT_NODELABEL.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-10 14:38:04 -05:00
Kumar Gala 35cad0884a dts: soc: atmel: sam: cleanup node labels to match SoC docs
Update dts files to use node labels that match Atmel SoC docs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-09 09:02:19 -05:00
Carles Cufi 0f9b3626c1 boards: nrf52_pca20020: Rename to thingy52_nrf52832
The board name for the Thingy:52, so far known as nrf52_pca20020, is
renamed to thingy52_nrf52832.  Its documentation and all references to
its name in the tree are updated accordingly. Overlay and configuration
files specific to this board are also renamed, to match the new board
name.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-04-06 13:09:07 +02:00
Kumar Gala f4b61c5505 drivers: gpio: gpio_imx: Convert driver to new DT_INST macros
Convert driver to use DT_INST macros and remove related board per
instance Kconfig symbol usage.

Additionally remove udoo_neo_full_m4.conf from gpio_basic_api test since
the Kconfig symbols don't need to be set anymore.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-04 09:34:00 -05:00
Kumar Gala a5375ead0c tests: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-31 19:31:20 -05:00