Skip to content

Commit 651ecab

Browse files
sgfeniexkartben
authored andcommitted
drivers: gpio: gpio_mcux_igpio: add pull strength configuration
The i.MXRT10xx series have configurable GPIO pull strengths. These are available for configuration in the pinctrl system, but not for regular GPIO use. This commit adds SOC-series specific GPIO configuration bits for selecting weak or strong GPIO pulls, similar to drive strengths available from other GPIO pin configuration examples. This has been tested on a custom i.MXRT1062 product. Signed-off-by: Stefan Giroux <[email protected]>
1 parent 5f67471 commit 651ecab

File tree

2 files changed

+41
-2
lines changed

2 files changed

+41
-2
lines changed

drivers/gpio/gpio_mcux_igpio.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <fsl_gpio.h>
1818

1919
#include <zephyr/drivers/pinctrl.h>
20+
#include <zephyr/dt-bindings/gpio/nxp-imx-igpio.h>
2021

2122
#include <zephyr/drivers/gpio/gpio_utils.h>
2223

@@ -90,8 +91,13 @@ static int mcux_igpio_configure(const struct device *dev,
9091
if (((flags & GPIO_PULL_UP) != 0) || ((flags & GPIO_PULL_DOWN) != 0)) {
9192
reg |= IOMUXC_SW_PAD_CTL_PAD_PUE_MASK;
9293
if (((flags & GPIO_PULL_UP) != 0)) {
93-
/* Use 100K pullup */
94-
reg |= IOMUXC_SW_PAD_CTL_PAD_PUS(2);
94+
if ((flags & NXP_IGPIO_PULL_STRONG) != 0) {
95+
/* Use 22K pullup */
96+
reg |= IOMUXC_SW_PAD_CTL_PAD_PUS(3);
97+
} else {
98+
/* Use 100K pullup */
99+
reg |= IOMUXC_SW_PAD_CTL_PAD_PUS(2);
100+
}
95101
} else {
96102
/* 100K pulldown */
97103
reg &= ~IOMUXC_SW_PAD_CTL_PAD_PUS_MASK;
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright (c) 2025 Feniex Industries Inc.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_GPIO_NXP_IMX_IGPIO_H_
7+
#define ZEPHYR_INCLUDE_DT_BINDINGS_GPIO_NXP_IMX_IGPIO_H_
8+
9+
/**
10+
* @name GPIO pull strength flags
11+
*
12+
* The pull strength flags are a Zephyr specific extension of the standard GPIO
13+
* flags specified by the Linux GPIO binding. Only applicable for NXP IMX
14+
* SoCs.
15+
*
16+
* The interface supports two different pull strengths:
17+
* `WEAK` - The lowest pull strength supported by the HW
18+
* `STRONG` - The highest pull strength supported by the HW
19+
*
20+
* @{
21+
*/
22+
/** @cond INTERNAL_HIDDEN */
23+
#define NXP_IGPIO_PULL_STRENGTH_POS 8
24+
#define NXP_IGPIO_PULL_STRENGTH_MASK (0x1U << NXP_IGPIO_PULL_STRENGTH_POS)
25+
/** @endcond */
26+
27+
/** pull up/down strengths (only applies to CONFIG_SOC_SERIES_IMXRT10XX) */
28+
#define NXP_IGPIO_PULL_WEAK (0x0U << NXP_IGPIO_PULL_STRENGTH_POS)
29+
#define NXP_IGPIO_PULL_STRONG (0x1U << NXP_IGPIO_PULL_STRENGTH_POS)
30+
31+
/** @} */
32+
33+
#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_GPIO_NXP_IMX_IGPIO_H_ */

0 commit comments

Comments
 (0)