Commit graph

99 commits

Author SHA1 Message Date
Adam Wojasinski cac170d2b9 modules: hal_nordic: Add I2S Kconfig symbols and translation to nrfx
Add Kconfig symbols for I2S 20 instance and translation symbols
used in nrfx drivers.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-11-20 09:24:05 +01:00
Natalia Pluta f5658254e8 modules: hal_nordic: Add QDEC Kconfig symbols and translation to nrfx
Add Kconfig symbols for QDEC instances (20, 21, 130, 131) and
translation symbols used in nrfx drivers.

Signed-off-by: Natalia Pluta <natalia.pluta@nordicsemi.no>
2023-11-20 09:19:45 +01:00
Patryk Lipinski 14827aad65 modules: hal_nordic: nrfx_glue: Changes in the macro statements
Changes in the macro statements that allows to build
with -Wudef flag enebaled, without errors.

Signed-off-by: Patryk Lipinski <patryk.lipinski@nordicsemi.no>
2023-11-15 09:59:56 +01:00
Tomasz Moń 8db6919695 nrfx_usbd: Rename to nrf_usbd_common
Rename local usbd copy from nrfx_usbd to nrf_usbd_common and use it in
both USB stacks. Renaming header to nrf_usbd_common.h allows breaking
changes in exposed interface. Mark all doxygen comments as internal
because local usbd copy should not be treated as public interface
because we are under refactoring process that aims to arrive at native
driver and therefore drop nrf_usbd_common in the future.

Use Zephyr constructs directly instead of nrfx glue macros.

No functional changes.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-11-07 14:06:51 +01:00
Tomasz Moń 2010d4d599 nrfx_usbd: Copy nrfx usbd code to Zephyr
Copy nrfx_usbd code from zephyrproject-rtos/hal_nordic git revision
d054a315eb888ba70e09e5f6decd4097b0276d1f. This enables us to refactor
the code towards a native driver in a step by step manner where the
smallest changes that bring biggest performance improvements are done
early on.

The code is not a vanilla copy from zephyrproject-rtos/hal_nordic.
The code was reformated with clang-format to match project style.
Manual modifications were done to change comments formatting, place
constant comparisons on the right and add blank lines to pass Zephyr
compliance check.

Relicense to Apache 2.0.

No functional changes.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-11-07 14:06:51 +01:00
Nikodem Kastelik 70db8cd12a modules: hal_nordic: nrfx: enable NRFX_GPIOTE1 for non-secure builds
Now it is needed to explicitly use NRF_GPIOTE1 instance
in nrfx_gpiote driver for non-secure builds.

Signed-off-by: Nikodem Kastelik <nikodem.kastelik@nordicsemi.no>
2023-10-24 11:13:53 +02:00
Adam Wojasinski 5685af0923 modules: hal_nordic: Add support for new TWIM instances
Add Kconfig and symbols for twim: 20-22, 30, 121, 130-137 instances

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-10-20 15:04:10 +02:00
Adam Wojasinski 5c1daef5ab drivers: spi: nrfx: Add SPIM Kconfig symbols for new instances
Add support for upcomming SPIM instances.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-10-20 15:03:17 +02:00
Andrzej Głąbek 5e38471e71 modules: hal_nordic: cmake: Fix checking if uicr DT node is accessible
According to cmake documentation, in the `if(<string>)` expression
the string evaluates to false unless its value is one of the true
constants. Thus, the commands under `if(${uicr_path})` are never
executed. Use `if(DEFINED uicr_path)` instead, since `uicr_path`
is returned by `dt_nodelabel()` and it will be undefined if such
node does not exist.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-10-13 21:23:17 +03:00
Alberto Escolar Piedras 6afe7cf216 hal nordic: cmake: Add support for nrf53_bsim boards
Also set the HAL variant appropriately when building for
the new nrf53_bsim boards.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-09-20 08:56:49 +02:00
Gerard Marull-Paretas 4d7d5ce226 modules: hal_nordic: nrfx: add support for 'gpio-as-nreset'
So that the HAL's system init function configures the reset GPIO as
nRESET if requested by the user.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-09-18 13:14:08 +02:00
Gerard Marull-Paretas e43c2f3eb5 modules: hal_nordic: inject CONFIG_NFCT_PINS_AS_GPIOS
If the users configures this option in devicetree, ie,

```
&uicr {
    nfct-pins-as-gpios;
};
```

CMake will inject the HAL-specific CONFIG_NFCT_PINS_AS_GPIOS definition,
so that the necessary operations are performed during system init.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-09-15 16:05:28 +02:00
Jordan Yates 1e06ba2328 soc: arm: nordic: handle nRF52832 anomaly 109
Enable workaround for anomaly 109 by default when affected peripherals
are enabled.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-09-13 12:05:27 +02:00
Alberto Escolar Piedras 65cd717152 modules: hal_nordic: Make module directory avaliable to others
Make the nrfx module directory avaliable to other
cmake files.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-08-24 15:40:00 +02:00
Natalia Pluta 76bb1d7453 modules: hal_nordic: Add nrfx specific drivers logging Kconfig
This commit introduces Kconfig symbols for enabling logging
for each nrfx drivers in Zephyr.

Example Usage:
To enable logging for the NRFX ADC driver, add the following
line to the project's configuration file (prj.conf):
CONFIG_NRFX_ADC_LOG=y

The purpose of this change is to enable selective logging
in Zephyr for specific nrfx drivers.

Signed-off-by: Natalia Pluta <natalia.pluta@nordicsemi.no>
2023-08-08 12:34:19 +00:00
Natalia Pluta 764466a6da modules: hal_nordic: nrfx: Add zephyr to nrfx logging symbols mapping
A Kconfig symbol mapping is necessary to enable logging for specific
nrfx drivers in Zephyr, allowing the association of these symbols with
their corresponding nrfx-specific symbols.

Signed-off-by: Natalia Pluta <natalia.pluta@nordicsemi.no>
2023-08-08 12:34:19 +00:00
Tomasz Moń 440af3ecc8 modules: hal_nordic: nrfx: Make ISO IN ZLP configurable
nRF USBD ISOINCONFIG register controls USBD behavior after receiving IN
token addressed to ISO IN endpoint when the endpoint was not armed with
data. The options are:
  * NoResp, in which case there is no response (i.e. bus timeout)
  * ZeroData, in which case device responds with ZLP

This commit both makes the ISOINCONFIG value configurable and changes
the default from NoResp to ZeroData. For reference, DWC_otg controller
will always send ZLP in such case and does not have NoResp equivalent.

Automatically sending ZLP when ISO IN endpoint is not armed resolves
periodic audio dropouts observed on Mac OS with USB Audio headset
sample. Apple USB Audio class driver will attempt recovery (abort all
pending URBs, switch to alternate config 0, switch to active alternate
config and submit new URBs) every time it sees kIOReturnNotResponding
status code. During recovery no audio data can be transferred and
therefore there are gaps in the audio stream.

Apple USB Audio driver sees kIOReturnNotResponding when there is bus
timeout (i.e. IN token was sent to nRF when the endpoint was not armed
and NoResp option was active). Activating ZeroData option results in
perfectly fine (albeit short) packet that does not trigger interface
recovery and thus fixes the USB Audio issues on Mac OS.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-07-14 09:37:04 +02:00
Adam Wojasinski 9aeb497321 modules: hal_nordic: nrfx_config: Align to updates in nrfx 3.1.0
Align config files to templates introduced with nrfx 3.1.0 release

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-07-13 13:21:41 +02:00
Adam Wojasinski 09fa46ee4e drivers: sensor: qdec_nrfx: Add multi-instance support for QDEC SHIM
Reworked QDEC SHIM to suppor multi-instance peripheral. Patch includes
Kconfig alignment for proper instance handling.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-05-05 11:47:53 +02:00
Adam Wojasinski e3b3d0eea4 modules: hal_nordic: CMakeLists: Add source files for GPPI helper
nrfx 3.0.0 splits implementation of GPPI helper functions into
periph-specific source files.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-05-05 11:47:53 +02:00
Adam Wojasinski 39b32a4f68 modules: hal_nordic: nrfx_glue: Add cache auxiliary macros
Add cache auxiliary macros needed nrfy layer in nrfx drivers SW stack.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-05-05 11:47:53 +02:00
Adam Wojasinski 1535e0f8ad modules: hal_nordic: nrfx_config: Update nrfx_config files to nrfx 3.0
Update config files to recently released with new nrfx 3.0

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-05-05 11:47:53 +02:00
Andrzej Głąbek 7a54aed015 modules: hal_nordic: nrfx: Handle properly I2S0 instance
Although existing nRF SoCs have only one I2S instance, the nrfx_i2s
driver has now multi-instance API and the related nrfx configuration
symbols need to be used appropriately.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-05-05 11:47:53 +02:00
Andrzej Głąbek 2a4373ce0d soc: nordic_nrf: nrf91: Add support for nRF9161 SiP / nRF9120 SoC
The nRF9161 is technically a SiP (System-in-Package) that consists of
the nRF9120 SoC and additional components like PMIC, FEM, and XTAL,
so for nrfx/MDK the nRF9120 SoC is to be selected as the build target,
but since the nRF9161 is what a user can actually see on a board, using
only nRF9120 in the Zephyr build infrastructure might be confusing.
That's why in the top level of SoC definitions (for user-configurable
options in Kconfig, for example) the nRF9161 term is used and nRF9120
underneath.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-04-17 09:30:12 -07:00
Nikodem Kastelik 6bd52d553f modules: hal_nordic: nrfx: add NRF9120_XXAA support in nrfx_config
There is a single config file for nRF9120 and nRF9160.

Signed-off-by: Nikodem Kastelik <nikodem.kastelik@nordicsemi.no>
2023-04-11 14:39:59 +02:00
Alberto Escolar Piedras 8a5273525e nrf52_bsim: Convert from a nRF52832 to a nRF52833
The nRF HW models have been updated to correspond to a 52833 instead
of a 52832. Let's follow them.

The motivation for the change is to enable proper BIS encryption support
(for BT LE Audio ISO).

Changes:

* Point in manifest to latest HW models

* SOC_COMPATIBLE_NRF52832 has been removed, and SOC_COMPATIBLE_NRF52833
added in its place (with no uses at this point)

* Where SOC_COMPATIBLE_NRF52832 was used to set encryption like for a 52832
(to avoid using the MAXPACKETLENGHT), we set the condition to just
SOC_NRF52832.
Note: The MAXPACKETLENGHT register exists in the new simulated nrf52833,
thought it does nothing.

* In the BLE ctrl LLL radio HAL, all macros are renamed accordingly
(timings are NOT changed).

* Board dts definition now refers to the 52833 soc definition. New 52833
features set as not supported by now.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-01-26 09:29:18 +01:00
Reto Schneider cb7791baf1 soc: nrf52: Kconfig option for nRF52840 anomaly 198
Enabling by default (if SPI3 used) because it affects all revisions
since "Engineering B", including the most recent one as of today
(revision 3).

Size changes when enabled:
 - -Og: flash +160 bytes (+0.02%), RAM +8 bytes (+0.01%)
 - -Os: flash +144 bytes (+0.02%), no change to RAM usage

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2022-12-27 15:32:22 +01:00
Nikodem Kastelik 67718641bf modules: hal_nordic: nrfx: switch to 2.10 API
Switch to use newest 2.10 API version in nrfx by default.
It changes 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
Adam Wojasinski f762aa9aa2 modules: hal_nordic: Add API version symbol to nrfx_config.h
This commit adds API version symbols. The symbol is used in nrfx
drivers, where new API-breaking changes are introduced. Symbol
guards conflicting API.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2022-11-03 11:39:01 +01: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
Andrzej Głąbek c08442c85a modules: hal_nordic: Adapt nrfx_busy_wait() for !SYS_CLOCK_EXISTS case
When the SYS_CLOCK_EXISTS Kconfig option is not enabled, k_busy_wait()
has no implementation, so in such case, call nrfx_coredep_delay_us()
directly.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-06-15 17:04:30 -05:00
Gerard Marull-Paretas 5f5a905784 modules: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all modules code to the
new prefix <zephyr/...>. Note that the conversion has been scripted,
refer to zephyrproject-rtos#45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 19:57:47 +02:00
Andrzej Głąbek 451a6ed6ab modules: hal_nordic: Refactor nrfx related Kconfig options
Change dependencies of the Kconfig options that enable particular nrfx
drivers so that the drivers and their instances are available when
a devicetree node with a corresponding compatible property exists,
no matter if it is enabled or not.
Change the options that enable compilation of multi-instance drivers
to be promptless helpers only (not directly configurable for users),
as they need to be enabled only together with some options that enable
particular instances of a given driver, and those options select them
as needed.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-04-02 15:14:38 +02:00
Andrzej Głąbek 222d42c22a modules: hal_nordic: Improve reservation of resources for BT_CTLR
Instead of including from nrfx_glue.h a specific Zephyr Bluetooth
controller header file that defines PPI and GPIOTE resources to be
reserved for exclusive use by the controller, include a file with
only a fixed name and expect the chosen Bluetooth controller to
provide the location of this file in include paths. This way, when
a different Bluetooth controller implementation is used downstream,
a different file can be easily pointed to.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-15 14:59:35 +01: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
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
Krzysztof Chruscinski 3457ebc667 modules: hal_nordic: Add NRFX_GPIOTE_NUM_OF_EVT_HANDLERS option
Add option to specifiy number of nrfx_gpiote user handlers in Kconfig.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-04 09:50:02 +01:00
Krzysztof Chruscinski 5ef63d8313 Bluetooth: Controller: nordic: Rework hw resources files
Move all defines that specifies (D)PPI resources which are used
to dedicated files which have no include dependencies. This allow
to use them in nrfx_glue.h to specify fixed (D)PPI channels used
by the bluetooth.

Additionally, added mask with GPIOTE channels used by the bluetooth
controller. It was previously not defined which could lead to
conflicts since same channels could be allocated by the nrfx_gpiote
user

Updated nrfx_glue.h to use new approach.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-12-02 09:55:48 +01:00
Krzysztof Chruscinski 1345b2ddd4 modules: hal_nordic: nrfx: Set NRF_SKIP_FICR_NS_COPY_TO_RAM
Set NRF_SKIP_FICR_NS_COPY_TO_RAM for nrf53 and nrf91 until corresponding
memory region is excluded from use.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-12-02 09:55:48 +01:00
Krzysztof Chruscinski 7e0f1d08e4 modules: hal_nordic: Update nrfx to version 2.6.0
Update the hal_nordic module revision, to switch to nrfx v2.6.0.

nrfx 2.6.0 includes extended API in nrfx_gpiote which can be
used by the zephyr shim.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-12-02 09:55:48 +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
Gregers Gram Rygg d47bd60933 soc: nordic_nrf: Add Kconfig option for enabling trace port
Add Kconfig option to enable the hardware trace port in the SystemInit()
function.

Signed-off-by: Gregers Gram Rygg <gregers.gram.rygg@nordicsemi.no>
2021-09-28 20:11:40 -04:00
Joakim Andersson fb90113dc8 modules: hal_nordic: Add nrf51 MDK defines needed to apply nrf51 erratas
Add nrf51 MDK defines needed to correctly select the nrf51 erratas
needed on the specific SoCs. The nrf51_erratas.h header file only uses
these defines to check which erratas should be applied.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-08-30 15:48:19 +02:00
Andrzej Głąbek 72e3bfe1c0 soc: nordic_nrf: Add Kconfig options for APPROTECT handling
Add Kconfig options that allow users to select the way the APPROTECT
mechanism is handled in the SystemInit() function.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-24 07:27:12 -04:00
Aurelien Jarno cbb2a9be77 logging: Enable SWO support for nRF SOCs
The nRF SOCs declare support for SWO using the HAS_SWO define. In
addition, the SWO pin has to be configured at runtime, which is done
through the Nordic HAL by defining ENABLE_SWO.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2021-05-18 12:28:25 -05:00
Rafał Kuźnia dbd66c8096 modules: hal_nordic: move nRF 802.15.4 Radio Driver glue to Zephyr
This commit moves all hal_nordic radio driver code that is
strictly dependent on Zephyr into the Zephyr repository.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
2021-03-05 12:56:15 +01:00
Ioannis Glaropoulos 007c8539f6 dts: arm: nordic: add QDEC nodes for nrf5340
Add device tree nodes for QDEC peripheral instances
for nRF5340 Application core.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2021-02-17 22:34:20 +03:00
Adam Zelik 3f2b07fc2f modules: nrfx_glue: Reserve PPI/DPPI resources used by 802.15.4 drv
Mark the PPI/DPPI channels and groups used by the 802.15.4 driver
as occupied and thus unavailable for allocation through nrfx_ppi.

Signed-off-by: Adam Zelik <adam.zelik@nordicsemi.no>
2021-02-15 08:10:19 -05:00
Andrzej Głąbek 251648afb4 modules: Move nrfx glue code to main Zephyr repository
Move nrfx glue code (nrfx integration files, related Kconfig entries,
and related part of CMakeLists.txt taken from the hal_nordic module)
to modules/hal_nordic/nrfx/ directory.
CMakeLists.txt located in modules/hal_nordic/ is now the main cmake
file for the hal_nordic module. It points back to cmake stuff related
to the nRF IEEE 802.15.4 driver that still remains in that module and
it adds the extracted nrfx part as a subdirectory.
Kconfig.nordic is renamed to Kconfig and moved to modules/hal_nordic/.
It sources nrfx related entries from that separate file.

Update also the manifest to point to accordingly modified hal_nordic
revision.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-01-19 17:35:04 +01:00