From 034ab467e6866bdda79fa2cb59407e0b9b83f152 Mon Sep 17 00:00:00 2001 From: Jake Choy Date: Tue, 15 May 2018 10:16:57 -0600 Subject: [PATCH] arch/arm/src/imxrt: Corrects some IOMUX controls. --- arch/arm/src/imxrt/imxrt_gpio.h | 16 ++++++++-------- arch/arm/src/imxrt/imxrt_iomuxc.c | 5 +++-- arch/arm/src/imxrt/imxrt_iomuxc.h | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/arch/arm/src/imxrt/imxrt_gpio.h b/arch/arm/src/imxrt/imxrt_gpio.h index 9cb086afb9..67ed5bc7ae 100644 --- a/arch/arm/src/imxrt/imxrt_gpio.h +++ b/arch/arm/src/imxrt/imxrt_gpio.h @@ -140,15 +140,15 @@ */ #define GPIO_ALT_SHIFT (27) /* Bits 27-29: Peripheral alternate function */ -#define GPIO_ALT_MASK (15 << GPIO_ALT_SHIFT) -# define GPIO_ALT0 (0 << GPIO_ALT_SHIFT) /* Alternate function 1 */ -# define GPIO_ALT1 (1 << GPIO_ALT_SHIFT) /* Alternate function 2 */ -# define GPIO_ALT2 (2 << GPIO_ALT_SHIFT) /* Alternate function 3 */ -# define GPIO_ALT3 (3 << GPIO_ALT_SHIFT) /* Alternate function 4 */ -# define GPIO_ALT4 (4 << GPIO_ALT_SHIFT) /* Alternate function 5 */ +#define GPIO_ALT_MASK (7 << GPIO_ALT_SHIFT) +# define GPIO_ALT0 (0 << GPIO_ALT_SHIFT) /* Alternate function 0 */ +# define GPIO_ALT1 (1 << GPIO_ALT_SHIFT) /* Alternate function 1 */ +# define GPIO_ALT2 (2 << GPIO_ALT_SHIFT) /* Alternate function 2 */ +# define GPIO_ALT3 (3 << GPIO_ALT_SHIFT) /* Alternate function 3 */ +# define GPIO_ALT4 (4 << GPIO_ALT_SHIFT) /* Alternate function 4 */ /* Alternate function 5 is GPIO */ -# define GPIO_ALT6 (6 << GPIO_ALT_SHIFT) /* Alternate function 1 */ -# define GPIO_ALT7 (7 << GPIO_ALT_SHIFT) /* Alternate function 1 */ +# define GPIO_ALT6 (6 << GPIO_ALT_SHIFT) /* Alternate function 6 */ +# define GPIO_ALT7 (7 << GPIO_ALT_SHIFT) /* Alternate function 7 */ /* Interrupt edge/level configuration * diff --git a/arch/arm/src/imxrt/imxrt_iomuxc.c b/arch/arm/src/imxrt/imxrt_iomuxc.c index c91fbda912..4346343ada 100644 --- a/arch/arm/src/imxrt/imxrt_iomuxc.c +++ b/arch/arm/src/imxrt/imxrt_iomuxc.c @@ -241,9 +241,10 @@ int imxrt_iomux_configure(uintptr_t padctl, iomux_pinset_t ioset) /* Select CMOS input or Schmitt Trigger input */ + regval = 0; if ((ioset & IOMUX_SCHMITT_TRIGGER) != 0) { - regval |= PADCTL_SRE; + regval |= PADCTL_HYS; } /* Select drive strength */ @@ -291,7 +292,7 @@ int imxrt_iomux_configure(uintptr_t padctl, iomux_pinset_t ioset) if ((ioset & IOMUX_SLEW_FAST) != 0) { - regval |= PADCTL_HYS; + regval |= PADCTL_SRE; } /* Write the result to the specified Pad Control register */ diff --git a/arch/arm/src/imxrt/imxrt_iomuxc.h b/arch/arm/src/imxrt/imxrt_iomuxc.h index 2bb9df9bf8..994e9231be 100644 --- a/arch/arm/src/imxrt/imxrt_iomuxc.h +++ b/arch/arm/src/imxrt/imxrt_iomuxc.h @@ -119,7 +119,7 @@ * .... .... .... .SS. */ -#define IOMUX_SPEED_SHIFT (2) /* Bits 2-3: Speed */ +#define IOMUX_SPEED_SHIFT (1) /* Bits 1-2: Speed */ #define IOMUX_SPEED_MASK (3 << IOMUX_SPEED_SHIFT) # define IOMUX_SPEED_LOW (SPEED_LOW << IOMUX_SPEED_SHIFT) /* Low frequency (50 MHz) */ # define IOMUX_SPEED_MEDIUM (SPEED_MEDIUM << IOMUX_SPEED_SHIFT) /* Medium frequency (100, 150 MHz) */