Skip to content

Commit 3fd9c6d

Browse files
committed
tests: lpc devices test pins enablement
LPC54114 to use D0 and D1 pinout. LPC55S69 to use A0 and A1 pinout. Pins enabled to be used as GPIO for 2 pin test gpio_basic_api. Signed-off-by: Andrei Gansari <[email protected]>
1 parent 2ddfddb commit 3fd9c6d

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

boards/arm/lpcxpresso54114/pinmux.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ static int lpcxpresso_54114_pinmux_init(struct device *dev)
9090
IOCON_PIO_OPENDRAIN_DI
9191
);
9292
pinmux_pin_set(port0, 4, port0_pin4_config);
93+
9394
#endif
9495

9596
#ifdef CONFIG_GPIO_MCUX_LPC_PORT1

boards/arm/lpcxpresso55s69/pinmux.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static int lpcxpresso_55s69_pinmux_init(struct device *dev)
7171
IOCON_PIO_SLEW_STANDARD |
7272
IOCON_PIO_OPENDRAIN_DI
7373
);
74-
pinmux_pin_set(port1, DT_ALIAS_SW0_GPIOS_PIN, sw1_config);
74+
pinmux_pin_set(port1, DT_ALIAS_SW1_GPIOS_PIN, sw1_config);
7575
#endif
7676

7777
#ifdef DT_GPIO_KEYS_SW2_GPIO_CONTROLLER
@@ -84,7 +84,7 @@ static int lpcxpresso_55s69_pinmux_init(struct device *dev)
8484
IOCON_PIO_SLEW_STANDARD |
8585
IOCON_PIO_OPENDRAIN_DI
8686
);
87-
pinmux_pin_set(port1, DT_ALIAS_SW0_GPIOS_PIN, sw2_config);
87+
pinmux_pin_set(port1, DT_ALIAS_SW2_GPIOS_PIN, sw2_config);
8888
#endif
8989

9090
return 0;

tests/drivers/gpio/gpio_basic_api/src/main.c

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@
88
#include "test_gpio.h"
99

1010
/* Grotesque hack for pinmux boards */
11-
#ifdef CONFIG_BOARD_FRDM_K64F
11+
#if defined(CONFIG_BOARD_FRDM_K64F)
1212
#include <drivers/pinmux.h>
1313
#include <fsl_port.h>
1414
#elif defined(CONFIG_BOARD_UDOO_NEO_FULL_M4)
1515
#include "device_imx.h"
16-
#endif
17-
18-
#ifdef CONFIG_BOARD_MIMXRT1050_EVK
16+
#elif defined(CONFIG_BOARD_MIMXRT1050_EVK)
1917
#include <fsl_iomuxc.h>
18+
#elif defined(CONFIG_SOC_FAMILY_LPC)
19+
#include <drivers/pinmux.h>
20+
#include "soc.h"
2021
#endif
2122

2223
static void board_setup(void)
@@ -32,7 +33,7 @@ static void board_setup(void)
3233
}
3334
#endif
3435

35-
#ifdef CONFIG_BOARD_FRDM_K64F
36+
#if defined(CONFIG_BOARD_FRDM_K64F)
3637
/* TODO figure out how to get this from "GPIO_2" */
3738
const char *pmx_name = "portc";
3839
struct device *pmx = device_get_binding(pmx_name);
@@ -81,9 +82,7 @@ static void board_setup(void)
8182
IOMUXC_SW_PAD_CTL_PAD_RGMII2_RD3_PKE_MASK |
8283
IOMUXC_SW_PAD_CTL_PAD_RGMII2_RD3_SPEED(2) |
8384
IOMUXC_SW_PAD_CTL_PAD_RGMII2_RD3_DSE(6);
84-
#endif
85-
86-
#ifdef CONFIG_BOARD_MIMXRT1050_EVK
85+
#elif defined(CONFIG_BOARD_MIMXRT1050_EVK)
8786
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_06_GPIO1_IO22, 0);
8887
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_07_GPIO1_IO23, 0);
8988

@@ -97,6 +96,19 @@ static void board_setup(void)
9796
IOMUXC_SW_PAD_CTL_PAD_PKE_MASK |
9897
IOMUXC_SW_PAD_CTL_PAD_SPEED(2) |
9998
IOMUXC_SW_PAD_CTL_PAD_DSE(6));
99+
#elif defined(CONFIG_SOC_FAMILY_LPC)
100+
/* Assumes ARDUINO pins are mapped on PORT0 on all boards*/
101+
struct device *port0 =
102+
device_get_binding(CONFIG_PINMUX_MCUX_LPC_PORT0_NAME);
103+
const u32_t pin_config = (
104+
IOCON_PIO_FUNC0 |
105+
IOCON_PIO_INV_DI |
106+
IOCON_PIO_DIGITAL_EN |
107+
IOCON_PIO_INPFILT_OFF |
108+
IOCON_PIO_OPENDRAIN_DI
109+
);
110+
pinmux_pin_set(port0, PIN_IN, pin_config);
111+
pinmux_pin_set(port0, PIN_OUT, pin_config);
100112
#endif
101113
}
102114

0 commit comments

Comments
 (0)