Skip to content

Commit 7a70fab

Browse files
parthitcenashif
authored andcommitted
drivers: gpio: add support for mspm0L series banks
All the HAL API/wrapper depends on PINCM indexing, which cannot be derived from neither pin number nor the address offset. With current approach, update the LUT table of possible PINCM's for L series with GPIO A, B and C banks. Signed-off-by: Parthiban Nallathambi <[email protected]>
1 parent 4e78996 commit 7a70fab

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

drivers/gpio/gpio_mspm0.c

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,18 @@ static uint32_t gpioa_pincm_lut[NUM_GPIOA_PIN] = {
4747
IOMUX_PINCM54, IOMUX_PINCM55, IOMUX_PINCM59, IOMUX_PINCM60, IOMUX_PINCM3, IOMUX_PINCM4,
4848
IOMUX_PINCM5, IOMUX_PINCM6,
4949
};
50+
#elif CONFIG_SOC_SERIES_MSPM0L /* if CONFIG_SOC_SERIES_MSPM0L */
51+
#define GPIOA_NODE DT_NODELABEL(gpioa)
52+
#define NUM_GPIOA_PIN 31
53+
#define gpioa_pins NUM_GPIOA_PIN
54+
static uint32_t gpioa_pincm_lut[NUM_GPIOA_PIN] = {
55+
IOMUX_PINCM1, IOMUX_PINCM2, IOMUX_PINCM7, IOMUX_PINCM8, IOMUX_PINCM9, IOMUX_PINCM10,
56+
IOMUX_PINCM11, IOMUX_PINCM14, IOMUX_PINCM19, IOMUX_PINCM20, IOMUX_PINCM25, IOMUX_PINCM26,
57+
IOMUX_PINCM38, IOMUX_PINCM39, IOMUX_PINCM40, IOMUX_PINCM41, IOMUX_PINCM42, IOMUX_PINCM49,
58+
IOMUX_PINCM50, IOMUX_PINCM51, IOMUX_PINCM52, IOMUX_PINCM56, IOMUX_PINCM57, IOMUX_PINCM67,
59+
IOMUX_PINCM68, IOMUX_PINCM69, IOMUX_PINCM73, IOMUX_PINCM74, IOMUX_PINCM3, IOMUX_PINCM4,
60+
IOMUX_PINCM5
61+
};
5062
#else
5163
#error "Series lookup table not supported"
5264
#endif /* if CONFIG_SOC_SERIES_MSPM0G */
@@ -64,9 +76,33 @@ static uint32_t gpiob_pincm_lut[NUM_GPIOB_PIN] = {
6476
IOMUX_PINCM44, IOMUX_PINCM45, IOMUX_PINCM48, IOMUX_PINCM49, IOMUX_PINCM50, IOMUX_PINCM51,
6577
IOMUX_PINCM52, IOMUX_PINCM56, IOMUX_PINCM57, IOMUX_PINCM58,
6678
};
79+
#elif CONFIG_SOC_SERIES_MSPM0L /* if CONFIG_SOC_SERIES_MSPM0L */
80+
#define GPIOB_NODE DT_NODELABEL(gpiob)
81+
#define NUM_GPIOB_PIN 32
82+
#define gpiob_pins NUM_GPIOB_PIN
83+
static uint32_t gpiob_pincm_lut[NUM_GPIOB_PIN] = {
84+
IOMUX_PINCM12, IOMUX_PINCM13, IOMUX_PINCM15, IOMUX_PINCM16, IOMUX_PINCM17, IOMUX_PINCM18,
85+
IOMUX_PINCM27, IOMUX_PINCM28, IOMUX_PINCM29, IOMUX_PINCM30, IOMUX_PINCM31, IOMUX_PINCM32,
86+
IOMUX_PINCM33, IOMUX_PINCM34, IOMUX_PINCM35, IOMUX_PINCM36, IOMUX_PINCM37, IOMUX_PINCM53,
87+
IOMUX_PINCM54, IOMUX_PINCM55, IOMUX_PINCM62, IOMUX_PINCM63, IOMUX_PINCM64, IOMUX_PINCM65,
88+
IOMUX_PINCM66, IOMUX_PINCM70, IOMUX_PINCM71, IOMUX_PINCM72, IOMUX_PINCM21, IOMUX_PINCM22,
89+
IOMUX_PINCM23, IOMUX_PINCM24
90+
};
6791
#endif /* CONFIG_SOC_SERIES_MSPM0G */
6892
#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(gpiob), okay) */
6993

94+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpioc), okay)
95+
#define GPIOC_NODE DT_NODELABEL(gpioc)
96+
#ifdef CONFIG_SOC_SERIES_MSPM0L
97+
#define NUM_GPIOC_PIN 10
98+
#define gpioc_pins NUM_GPIOC_PIN
99+
static uint32_t gpioc_pincm_lut[NUM_GPIOC_PIN] = {
100+
IOMUX_PINCM43, IOMUX_PINCM44, IOMUX_PINCM45, IOMUX_PINCM46, IOMUX_PINCM47,
101+
IOMUX_PINCM48, IOMUX_PINCM58, IOMUX_PINCM59, IOMUX_PINCM60, IOMUX_PINCM61,
102+
};
103+
#endif /* CONFIG_SOC_SERIES */
104+
#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(gpioc), okay) */
105+
70106
static int gpio_mspm0_port_get_raw(const struct device *port, uint32_t *value)
71107
{
72108
const struct gpio_mspm0_config *config = port->config;
@@ -236,6 +272,7 @@ static void gpio_mspm0_isr(const struct device *port)
236272
const struct device *dev_list[] = {
237273
DEVICE_DT_GET_OR_NULL(GPIOA_NODE),
238274
DEVICE_DT_GET_OR_NULL(GPIOB_NODE),
275+
DEVICE_DT_GET_OR_NULL(GPIOC_NODE),
239276
};
240277

241278
for (uint8_t i = 0; i < ARRAY_SIZE(dev_list); i++) {
@@ -356,3 +393,7 @@ GPIO_DEVICE_INIT_MSPM0(a);
356393
#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpiob), okay)
357394
GPIO_DEVICE_INIT_MSPM0(b);
358395
#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(gpiob), okay) */
396+
397+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(gpioc), okay)
398+
GPIO_DEVICE_INIT_MSPM0(c);
399+
#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(gpioc), okay) */

0 commit comments

Comments
 (0)