drivers: pinctrl: update lpc pinctrl driver for lpc11u6x

Update pin control driver for lpc11u6x. This SOC does not have a HAL,
so fsl_clock is not available. It also lacks a slew-rate field in the
IOCON register, so this property must be optional.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
This commit is contained in:
Daniel DeGrasse 2022-04-12 16:54:58 -05:00 committed by David Leach
commit 1916fb21dd
4 changed files with 84 additions and 5 deletions

View file

@ -2,12 +2,14 @@
# SPDX-License-Identifier: Apache-2.0
DT_COMPAT_NXP_LPC_PINCTRL := nxp,lpc-iocon-pinctrl
DT_COMPAT_NXP_LPC_11U6X_PINCTRL := nxp,lpc11u6x-pinctrl
DT_COMPAT_NXP_RT_PINCTRL := nxp,rt-iocon-pinctrl
config PINCTRL_NXP_IOCON
bool "IOCON Pin controller driver for NXP LPC MCUs"
depends on SOC_FAMILY_LPC || SOC_SERIES_IMX_RT6XX || SOC_SERIES_IMX_RT5XX
default $(dt_compat_enabled,$(DT_COMPAT_NXP_LPC_PINCTRL)) || \
$(dt_compat_enabled,$(DT_COMPAT_NXP_RT_PINCTRL))
$(dt_compat_enabled,$(DT_COMPAT_NXP_RT_PINCTRL)) || \
$(dt_compat_enabled,$(DT_COMPAT_NXP_LPC_11U6X_PINCTRL))
help
Enable pin controller driver for NXP LPC MCUs

View file

@ -5,7 +5,9 @@
*/
#include <zephyr/drivers/pinctrl.h>
#if !defined(CONFIG_SOC_SERIES_LPC11U6X)
#include <fsl_clock.h>
#endif
#define OFFSET(mux) (((mux) & 0xFFF00000) >> 20)
#define TYPE(mux) (((mux) & 0xC0000) >> 18)
@ -37,7 +39,7 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt,
break;
default:
/* Should not occur */
assert(TYPE(pin_mux <= IOCON_TYPE_A));
__ASSERT_NO_MSG(TYPE(pin_mux) <= IOCON_TYPE_A);
}
/* Set pinmux */
*(iocon + offset) = pin_mux;
@ -45,8 +47,8 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt,
return 0;
}
#ifdef CONFIG_SOC_FAMILY_LPC
/* LPC family needs iocon clock to be enabled */
#if defined(CONFIG_SOC_FAMILY_LPC) && !defined(CONFIG_SOC_SERIES_LPC11U6X)
/* LPC family (except 11u6x) needs iocon clock to be enabled */
static int pinctrl_clock_init(const struct device *dev)
{
@ -58,4 +60,4 @@ static int pinctrl_clock_init(const struct device *dev)
SYS_INIT(pinctrl_clock_init, PRE_KERNEL_1, 0);
#endif /* CONFIG_SOC_FAMILY_LPC */
#endif /* CONFIG_SOC_FAMILY_LPC && !CONFIG_SOC_SERIES_LPC11U6X */