1 /* 2 * Copyright (c) 2025 Texas Instruments 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #include <zephyr/init.h> 8 #include <zephyr/drivers/pinctrl.h> 9 #include <ti/driverlib/dl_gpio.h> 10 11 #define DT_DRV_COMPAT ti_mspm0_pinctrl 12 13 #define MSPM0_PINCM(pinmux) (pinmux >> 0x10) 14 #define MSPM0_PIN_FUNCTION(pinmux) (pinmux & 0x3F) 15 pinctrl_configure_pins(const pinctrl_soc_pin_t * pins,uint8_t pin_cnt,uintptr_t reg)16int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, 17 uint8_t pin_cnt, 18 uintptr_t reg) 19 { 20 ARG_UNUSED(reg); 21 22 uint8_t pin_function; 23 uint32_t pin_cm; 24 uint32_t iomux; 25 26 for (int i = 0; i < pin_cnt; i++) { 27 pin_cm = MSPM0_PINCM(pins[i].pinmux); 28 pin_function = MSPM0_PIN_FUNCTION(pins[i].pinmux); 29 iomux = pins[i].iomux; 30 if (pin_function == 0x00) { 31 DL_GPIO_initPeripheralAnalogFunction(pin_cm); 32 } else { 33 DL_GPIO_initPeripheralFunction(pin_cm, 34 (iomux | pin_function)); 35 } 36 } 37 38 return 0; 39 } 40