Skip to content

Commit c32f2a4

Browse files
[nrf fromtree] drivers: nrf: remove handling of cross domain pins
Remove the handling of cross domain pins from nrf drivers. To use cross domain in tests, force on constlat and disable power domains for the test. Signed-off-by: Bjarki Arge Andreasen <[email protected]> (cherry picked from commit 306c3d4)
1 parent 3a3b437 commit c32f2a4

File tree

7 files changed

+3
-271
lines changed

7 files changed

+3
-271
lines changed

drivers/serial/uart_nrfx_uarte.c

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -127,27 +127,6 @@ LOG_MODULE_REGISTER(uart_nrfx_uarte, CONFIG_UART_LOG_LEVEL);
127127
*/
128128
#define UARTE_ANY_HIGH_SPEED (UARTE_FOR_EACH_INSTANCE(INSTANCE_IS_HIGH_SPEED, (||), (0)))
129129

130-
#define UARTE_PINS_CROSS_DOMAIN(unused, prefix, idx, _) \
131-
COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(UARTE(prefix##idx)), \
132-
(UARTE_PROP(idx, cross_domain_pins_supported)), \
133-
(0))
134-
135-
#if UARTE_FOR_EACH_INSTANCE(UARTE_PINS_CROSS_DOMAIN, (||), (0))
136-
#include <hal/nrf_gpio.h>
137-
/* Certain UARTE instances support usage of cross domain pins in form of dedicated pins on
138-
* a port different from the default one.
139-
*/
140-
#define UARTE_CROSS_DOMAIN_PINS_SUPPORTED 1
141-
#endif
142-
143-
#if UARTE_CROSS_DOMAIN_PINS_SUPPORTED && defined(CONFIG_NRF_SYS_EVENT)
144-
#include <nrf_sys_event.h>
145-
/* To use cross domain pins, constant latency mode needs to be applied, which is
146-
* handled via nrf_sys_event requests.
147-
*/
148-
#define UARTE_CROSS_DOMAIN_PINS_HANDLE 1
149-
#endif
150-
151130
#ifdef UARTE_ANY_CACHE
152131
/* uart120 instance does not retain BAUDRATE register when ENABLE=0. When this instance
153132
* is used then baudrate must be set after enabling the peripheral and not before.
@@ -415,10 +394,6 @@ struct uarte_nrfx_config {
415394
#endif
416395
uint8_t *poll_out_byte;
417396
uint8_t *poll_in_byte;
418-
#if UARTE_CROSS_DOMAIN_PINS_SUPPORTED
419-
bool cross_domain;
420-
int8_t default_port;
421-
#endif
422397
};
423398

424399
/* Using Macro instead of static inline function to handle NO_OPTIMIZATIONS case
@@ -493,32 +468,6 @@ static void uarte_disable_locked(const struct device *dev, uint32_t dis_mask)
493468
(void)pinctrl_apply_state(config->pcfg, PINCTRL_STATE_SLEEP);
494469
}
495470

496-
#if UARTE_CROSS_DOMAIN_PINS_SUPPORTED
497-
static bool uarte_has_cross_domain_connection(const struct uarte_nrfx_config *config)
498-
{
499-
const struct pinctrl_dev_config *pcfg = config->pcfg;
500-
const struct pinctrl_state *state;
501-
int ret;
502-
503-
ret = pinctrl_lookup_state(pcfg, PINCTRL_STATE_DEFAULT, &state);
504-
if (ret < 0) {
505-
LOG_ERR("Unable to read pin state");
506-
return false;
507-
}
508-
509-
for (uint8_t i = 0U; i < state->pin_cnt; i++) {
510-
uint32_t pin = NRF_GET_PIN(state->pins[i]);
511-
512-
if ((pin != NRF_PIN_DISCONNECTED) &&
513-
(nrf_gpio_pin_port_number_extract(&pin) != config->default_port)) {
514-
return true;
515-
}
516-
}
517-
518-
return false;
519-
}
520-
#endif
521-
522471
#if defined(UARTE_ANY_NONE_ASYNC) && !defined(CONFIG_UART_NRFX_UARTE_NO_IRQ)
523472
/**
524473
* @brief Interrupt service routine.
@@ -805,20 +754,6 @@ static void uarte_periph_enable(const struct device *dev)
805754
(void)pinctrl_apply_state(config->pcfg, PINCTRL_STATE_DEFAULT);
806755
nrf_uarte_enable(uarte);
807756

808-
#if UARTE_CROSS_DOMAIN_PINS_SUPPORTED
809-
if (config->cross_domain && uarte_has_cross_domain_connection(config)) {
810-
#if UARTE_CROSS_DOMAIN_PINS_HANDLE
811-
int err;
812-
813-
err = nrf_sys_event_request_global_constlat();
814-
(void)err;
815-
__ASSERT_NO_MSG(err >= 0);
816-
#else
817-
__ASSERT(false, "NRF_SYS_EVENT needs to be enabled to use cross domain pins.\n");
818-
#endif
819-
}
820-
#endif
821-
822757
#if UARTE_BAUDRATE_RETENTION_WORKAROUND
823758
if (config->flags & UARTE_CFG_FLAG_VOLATILE_BAUDRATE) {
824759
nrf_uarte_baudrate_set(uarte,
@@ -3175,20 +3110,6 @@ static void uarte_pm_suspend(const struct device *dev)
31753110
wait_for_tx_stopped(dev);
31763111
}
31773112

3178-
#if UARTE_CROSS_DOMAIN_PINS_SUPPORTED
3179-
if (cfg->cross_domain && uarte_has_cross_domain_connection(cfg)) {
3180-
#if UARTE_CROSS_DOMAIN_PINS_HANDLE
3181-
int err;
3182-
3183-
err = nrf_sys_event_release_global_constlat();
3184-
(void)err;
3185-
__ASSERT_NO_MSG(err >= 0);
3186-
#else
3187-
__ASSERT(false, "NRF_SYS_EVENT needs to be enabled to use cross domain pins.\n");
3188-
#endif
3189-
}
3190-
#endif
3191-
31923113
(void)pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_SLEEP);
31933114
nrf_uarte_disable(uarte);
31943115
}
@@ -3518,11 +3439,6 @@ static int uarte_instance_deinit(const struct device *dev)
35183439
IF_ENABLED(CONFIG_UART_##idx##_NRF_HW_ASYNC, \
35193440
(.timer = NRFX_TIMER_INSTANCE( \
35203441
CONFIG_UART_##idx##_NRF_HW_ASYNC_TIMER),)) \
3521-
IF_ENABLED(UARTE_PINS_CROSS_DOMAIN(_, /*empty*/, idx, _), \
3522-
(.cross_domain = true, \
3523-
.default_port = \
3524-
DT_PROP_OR(DT_PHANDLE(UARTE(idx), \
3525-
default_gpio_port), port, -1),)) \
35263442
}; \
35273443
UARTE_DIRECT_ISR_DECLARE(idx) \
35283444
static int uarte_##idx##_init(const struct device *dev) \

drivers/spi/spi_nrfx_spim.c

Lines changed: 0 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -54,28 +54,6 @@ LOG_MODULE_REGISTER(spi_nrfx_spim, CONFIG_SPI_LOG_LEVEL);
5454
#define SPIM_FOR_EACH_INSTANCE(f, sep, off_code, ...) \
5555
NRFX_FOREACH_PRESENT(SPIM, f, sep, off_code, __VA_ARGS__)
5656

57-
#define SPIM_PINS_CROSS_DOMAIN(unused, prefix, idx, _) \
58-
COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(SPIM(prefix##idx)), \
59-
(SPIM_PROP(idx, cross_domain_pins_supported)), \
60-
(0))
61-
62-
#if NRFX_FOREACH_PRESENT(SPIM, SPIM_PINS_CROSS_DOMAIN, (||), (0))
63-
#include <hal/nrf_gpio.h>
64-
/* Certain SPIM instances support usage of cross domain pins in form of dedicated pins on
65-
* a port different from the default one.
66-
*/
67-
#define SPIM_CROSS_DOMAIN_SUPPORTED 1
68-
#endif
69-
70-
#if SPIM_CROSS_DOMAIN_SUPPORTED && defined(CONFIG_NRF_SYS_EVENT)
71-
#include <nrf_sys_event.h>
72-
/* To use cross domain pins, constant latency mode needs to be applied, which is
73-
* handled via nrf_sys_event requests.
74-
*/
75-
#define SPIM_CROSS_DOMAIN_PINS_HANDLE 1
76-
#endif
77-
78-
7957
struct spi_nrfx_data {
8058
struct spi_context ctx;
8159
const struct device *dev;
@@ -105,41 +83,11 @@ struct spi_nrfx_config {
10583
#endif
10684
uint32_t wake_pin;
10785
nrfx_gpiote_t wake_gpiote;
108-
#if SPIM_CROSS_DOMAIN_SUPPORTED
109-
bool cross_domain;
110-
int8_t default_port;
111-
#endif
11286
void *mem_reg;
11387
};
11488

11589
static void event_handler(const nrfx_spim_evt_t *p_event, void *p_context);
11690

117-
#if SPIM_CROSS_DOMAIN_SUPPORTED
118-
static bool spim_has_cross_domain_connection(const struct spi_nrfx_config *config)
119-
{
120-
const struct pinctrl_dev_config *pcfg = config->pcfg;
121-
const struct pinctrl_state *state;
122-
int ret;
123-
124-
ret = pinctrl_lookup_state(pcfg, PINCTRL_STATE_DEFAULT, &state);
125-
if (ret < 0) {
126-
LOG_ERR("Unable to read pin state");
127-
return false;
128-
}
129-
130-
for (uint8_t i = 0U; i < state->pin_cnt; i++) {
131-
uint32_t pin = NRF_GET_PIN(state->pins[i]);
132-
133-
if ((pin != NRF_PIN_DISCONNECTED) &&
134-
(nrf_gpio_pin_port_number_extract(&pin) != config->default_port)) {
135-
return true;
136-
}
137-
}
138-
139-
return false;
140-
}
141-
#endif
142-
14391
static inline void finalize_spi_transaction(const struct device *dev, bool deactivate_cs)
14492
{
14593
struct spi_nrfx_data *dev_data = dev->data;
@@ -686,20 +634,6 @@ static int spim_resume(const struct device *dev)
686634
return -EAGAIN;
687635
}
688636

689-
#if SPIM_CROSS_DOMAIN_SUPPORTED
690-
if (dev_config->cross_domain && spim_has_cross_domain_connection(dev_config)) {
691-
#if SPIM_CROSS_DOMAIN_PINS_HANDLE
692-
int err;
693-
694-
err = nrf_sys_event_request_global_constlat();
695-
(void)err;
696-
__ASSERT_NO_MSG(err >= 0);
697-
#else
698-
__ASSERT(false, "NRF_SYS_EVENT needs to be enabled to use cross domain pins.\n");
699-
#endif
700-
}
701-
#endif
702-
703637
return 0;
704638
}
705639

@@ -715,20 +649,6 @@ static void spim_suspend(const struct device *dev)
715649

716650
spi_context_cs_put_all(&dev_data->ctx);
717651

718-
#if SPIM_CROSS_DOMAIN_SUPPORTED
719-
if (dev_config->cross_domain && spim_has_cross_domain_connection(dev_config)) {
720-
#if SPIM_CROSS_DOMAIN_PINS_HANDLE
721-
int err;
722-
723-
err = nrf_sys_event_release_global_constlat();
724-
(void)err;
725-
__ASSERT_NO_MSG(err >= 0);
726-
#else
727-
__ASSERT(false, "NRF_SYS_EVENT needs to be enabled to use cross domain pins.\n");
728-
#endif
729-
}
730-
#endif
731-
732652
(void)pinctrl_apply_state(dev_config->pcfg, PINCTRL_STATE_SLEEP);
733653
}
734654

@@ -866,11 +786,6 @@ static int spi_nrfx_deinit(const struct device *dev)
866786
.wake_pin = NRF_DT_GPIOS_TO_PSEL_OR(SPIM(idx), wake_gpios, \
867787
WAKE_PIN_NOT_USED), \
868788
.wake_gpiote = WAKE_GPIOTE_INSTANCE(SPIM(idx)), \
869-
IF_ENABLED(SPIM_PINS_CROSS_DOMAIN(_, /*empty*/, idx, _), \
870-
(.cross_domain = true, \
871-
.default_port = \
872-
DT_PROP_OR(DT_PHANDLE(SPIM(idx), \
873-
default_gpio_port), port, -1),)) \
874789
.mem_reg = DMM_DEV_TO_REG(SPIM(idx)), \
875790
}; \
876791
BUILD_ASSERT(!SPIM_HAS_PROP(idx, wake_gpios) || \

drivers/spi/spi_nrfx_spis.c

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -32,27 +32,6 @@ LOG_MODULE_REGISTER(spi_nrfx_spis, CONFIG_SPI_LOG_LEVEL);
3232
#define SPIS_PROP(idx, prop) DT_PROP(SPIS(idx), prop)
3333
#define SPIS_HAS_PROP(idx, prop) DT_NODE_HAS_PROP(SPIS(idx), prop)
3434

35-
#define SPIS_PINS_CROSS_DOMAIN(unused, prefix, idx, _) \
36-
COND_CODE_1(DT_NODE_HAS_STATUS_OKAY(SPIS(prefix##idx)), \
37-
(SPIS_PROP(idx, cross_domain_pins_supported)), \
38-
(0))
39-
40-
#if NRFX_FOREACH_PRESENT(SPIS, SPIS_PINS_CROSS_DOMAIN, (||), (0))
41-
#include <hal/nrf_gpio.h>
42-
/* Certain SPIM instances support usage of cross domain pins in form of dedicated pins on
43-
* a port different from the default one.
44-
*/
45-
#define SPIS_CROSS_DOMAIN_SUPPORTED 1
46-
#endif
47-
48-
#if SPIS_CROSS_DOMAIN_SUPPORTED && defined(CONFIG_NRF_SYS_EVENT)
49-
#include <nrf_sys_event.h>
50-
/* To use cross domain pins, constant latency mode needs to be applied, which is
51-
* handled via nrf_sys_event requests.
52-
*/
53-
#define SPIS_CROSS_DOMAIN_PINS_HANDLE 1
54-
#endif
55-
5635
struct spi_nrfx_data {
5736
struct spi_context ctx;
5837
const struct device *dev;
@@ -72,38 +51,8 @@ struct spi_nrfx_config {
7251
const struct pinctrl_dev_config *pcfg;
7352
struct gpio_dt_spec wake_gpio;
7453
void *mem_reg;
75-
#if SPIS_CROSS_DOMAIN_SUPPORTED
76-
bool cross_domain;
77-
int8_t default_port;
78-
#endif
7954
};
8055

81-
#if SPIS_CROSS_DOMAIN_SUPPORTED
82-
static bool spis_has_cross_domain_connection(const struct spi_nrfx_config *config)
83-
{
84-
const struct pinctrl_dev_config *pcfg = config->pcfg;
85-
const struct pinctrl_state *state;
86-
int ret;
87-
88-
ret = pinctrl_lookup_state(pcfg, PINCTRL_STATE_DEFAULT, &state);
89-
if (ret < 0) {
90-
LOG_ERR("Unable to read pin state");
91-
return false;
92-
}
93-
94-
for (uint8_t i = 0U; i < state->pin_cnt; i++) {
95-
uint32_t pin = NRF_GET_PIN(state->pins[i]);
96-
97-
if ((pin != NRF_PIN_DISCONNECTED) &&
98-
(nrf_gpio_pin_port_number_extract(&pin) != config->default_port)) {
99-
return true;
100-
}
101-
}
102-
103-
return false;
104-
}
105-
#endif
106-
10756
static inline nrf_spis_mode_t get_nrf_spis_mode(uint16_t operation)
10857
{
10958
if (SPI_MODE_GET(operation) & SPI_MODE_CPOL) {
@@ -423,20 +372,6 @@ static void spi_nrfx_suspend(const struct device *dev)
423372
nrf_spis_disable(dev_config->spis.p_reg);
424373
}
425374

426-
#if SPIS_CROSS_DOMAIN_SUPPORTED
427-
if (dev_config->cross_domain && spis_has_cross_domain_connection(dev_config)) {
428-
#if SPIS_CROSS_DOMAIN_PINS_HANDLE
429-
int err;
430-
431-
err = nrf_sys_event_release_global_constlat();
432-
(void)err;
433-
__ASSERT_NO_MSG(err >= 0);
434-
#else
435-
__ASSERT(false, "NRF_SYS_EVENT needs to be enabled to use cross domain pins.\n");
436-
#endif
437-
}
438-
#endif
439-
440375
(void)pinctrl_apply_state(dev_config->pcfg, PINCTRL_STATE_SLEEP);
441376
}
442377

@@ -446,20 +381,6 @@ static void spi_nrfx_resume(const struct device *dev)
446381

447382
(void)pinctrl_apply_state(dev_config->pcfg, PINCTRL_STATE_DEFAULT);
448383

449-
#if SPIS_CROSS_DOMAIN_SUPPORTED
450-
if (dev_config->cross_domain && spis_has_cross_domain_connection(dev_config)) {
451-
#if SPIS_CROSS_DOMAIN_PINS_HANDLE
452-
int err;
453-
454-
err = nrf_sys_event_request_global_constlat();
455-
(void)err;
456-
__ASSERT_NO_MSG(err >= 0);
457-
#else
458-
__ASSERT(false, "NRF_SYS_EVENT needs to be enabled to use cross domain pins.\n");
459-
#endif
460-
}
461-
#endif
462-
463384
if (dev_config->wake_gpio.port == NULL) {
464385
nrf_spis_enable(dev_config->spis.p_reg);
465386
}
@@ -578,11 +499,6 @@ static int spi_nrfx_init(const struct device *dev)
578499
.max_buf_len = BIT_MASK(SPIS_PROP(idx, easydma_maxcnt_bits)), \
579500
.wake_gpio = GPIO_DT_SPEC_GET_OR(SPIS(idx), wake_gpios, {0}), \
580501
.mem_reg = DMM_DEV_TO_REG(SPIS(idx)), \
581-
IF_ENABLED(SPIS_PINS_CROSS_DOMAIN(_, /*empty*/, idx, _), \
582-
(.cross_domain = true, \
583-
.default_port = \
584-
DT_PROP_OR(DT_PHANDLE(SPIS(idx), \
585-
default_gpio_port), port, -1),)) \
586502
}; \
587503
BUILD_ASSERT(!DT_NODE_HAS_PROP(SPIS(idx), wake_gpios) || \
588504
!(DT_GPIO_FLAGS(SPIS(idx), wake_gpios) & GPIO_ACTIVE_LOW),\

dts/bindings/spi/nordic,nrf-spi-common.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,3 @@ properties:
6161
and SPI master again keeps the line in the low state
6262
Please note that the line must be configured and properly handled on
6363
both sides for the mechanism to work correctly.
64-
65-
default-gpio-port:
66-
type: phandle
67-
description: |
68-
SPI default GPIO port.
69-
70-
cross-domain-pins-supported:
71-
type: boolean
72-
description: |
73-
SPI allows usage of cross domain pins with constant latency mode required.

0 commit comments

Comments
 (0)