Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
/drivers/flash/*nrf* @nvlsianpu
/drivers/flash/*spi_nor* @pabigot
/drivers/flash/*stm32* @superna9999
/drivers/gpio/ @mnkp @pabigot
/drivers/gpio/*ht16k33* @henrikbrixandersen
/drivers/gpio/*stm32* @rsalveti @idlethread
/drivers/hwinfo/ @alexanderwachter
Expand Down
2 changes: 2 additions & 0 deletions boards/arm/atsamd21_xpro/atsamd21_xpro.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ toolchain:
- zephyr
- gnuarmemb
- xtools
supported:
- gpio
21 changes: 10 additions & 11 deletions boards/arm/lpcxpresso55s69/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ static int lpcxpresso_55s69_pinmux_init(struct device *dev)

#endif

#ifdef CONFIG_GPIO_MCUX_LPC_PORT0
const u32_t port0_pin5_config = (
#ifdef DT_GPIO_KEYS_SW0_GPIO_CONTROLLER
const u32_t sw0_config = (
IOCON_PIO_FUNC0 |
IOCON_PIO_MODE_PULLUP |
IOCON_PIO_INV_DI |
Expand All @@ -58,12 +58,11 @@ static int lpcxpresso_55s69_pinmux_init(struct device *dev)
IOCON_PIO_SLEW_STANDARD |
IOCON_PIO_OPENDRAIN_DI
);

pinmux_pin_set(port0, 5, port0_pin5_config);
pinmux_pin_set(port0, DT_ALIAS_SW0_GPIOS_PIN, sw0_config);
#endif

#ifdef CONFIG_GPIO_MCUX_LPC_PORT0
const u32_t port1_pin18_config = (
#ifdef DT_GPIO_KEYS_SW1_GPIO_CONTROLLER
const u32_t sw1_config = (
IOCON_PIO_FUNC0 |
IOCON_PIO_MODE_PULLUP |
IOCON_PIO_INV_DI |
Expand All @@ -72,10 +71,11 @@ static int lpcxpresso_55s69_pinmux_init(struct device *dev)
IOCON_PIO_SLEW_STANDARD |
IOCON_PIO_OPENDRAIN_DI
);
pinmux_pin_set(port1, DT_ALIAS_SW0_GPIOS_PIN, sw1_config);
#endif

pinmux_pin_set(port1, 18, port1_pin18_config);

const u32_t port1_pin9_config = (
#ifdef DT_GPIO_KEYS_SW2_GPIO_CONTROLLER
const u32_t sw2_config = (
IOCON_PIO_FUNC0 |
IOCON_PIO_MODE_PULLUP |
IOCON_PIO_INV_DI |
Expand All @@ -84,8 +84,7 @@ static int lpcxpresso_55s69_pinmux_init(struct device *dev)
IOCON_PIO_SLEW_STANDARD |
IOCON_PIO_OPENDRAIN_DI
);

pinmux_pin_set(port1, 9, port1_pin9_config);
pinmux_pin_set(port1, DT_ALIAS_SW0_GPIOS_PIN, sw2_config);
#endif

return 0;
Expand Down
1 change: 1 addition & 0 deletions boards/arm/mimxrt1060_evk/mimxrt1060_evk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ ram: 32768
flash: 8192
supported:
- display
- gpio
- hwinfo
- i2c
- netif:eth
Expand Down
5 changes: 5 additions & 0 deletions boards/riscv/rv32m1_vega/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ static int rv32m1_vega_pinmux_init(struct device *dev)
pinmux_pin_set(porte, 22, PORT_PCR_MUX(kPORT_MuxAsGpio));
pinmux_pin_set(porte, 27, PORT_PCR_MUX(kPORT_MuxAsGpio));

/* RGB LEDs */
pinmux_pin_set(porta, 22, PORT_PCR_MUX(kPORT_MuxAsGpio));
pinmux_pin_set(porta, 23, PORT_PCR_MUX(kPORT_MuxAsGpio));
pinmux_pin_set(porta, 24, PORT_PCR_MUX(kPORT_MuxAsGpio));

#if CONFIG_SPI_1
/* LPSPI1 SCK, SIN, SOUT, CS */
pinmux_pin_set(portb, 20, PORT_PCR_MUX(kPORT_MuxAlt2));
Expand Down
25 changes: 25 additions & 0 deletions drivers/gpio/Kconfig.gecko
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,29 @@ config GPIO_GECKO_PORTF
help
Enable Port F.

config GPIO_GECKO_PORTG
bool "Port G"
help
Enable Port G.

config GPIO_GECKO_PORTH
bool "Port H"
help
Enable Port H.

config GPIO_GECKO_PORTI
bool "Port I"
help
Enable Port I.

config GPIO_GECKO_PORTJ
bool "Port J"
help
Enable Port J.

config GPIO_GECKO_PORTK
bool "Port K"
help
Enable Port K.

endif # GPIO_GECKO
162 changes: 45 additions & 117 deletions drivers/gpio/gpio_gecko.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,141 +315,69 @@ static int gpio_gecko_common_init(struct device *dev)
}
#endif /* CONFIG_GPIO_GECKO */

#define GPIO_PORT_INIT(pl, pu) \
static int gpio_gecko_port##pl##_init(struct device *dev); \
\
static const struct gpio_gecko_config gpio_gecko_port##pl##_config = { \
.gpio_base = &GPIO->P[gpioPort##pu], \
.gpio_index = gpioPort##pu, \
}; \
\
static struct gpio_gecko_data gpio_gecko_port##pl##_data; \
\
DEVICE_AND_API_INIT(gpio_gecko_port##pl, DT_GPIO_GECKO_PORT##pu##_NAME, \
gpio_gecko_port##pl##_init, \
&gpio_gecko_port##pl##_data, \
&gpio_gecko_port##pl##_config, \
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \
&gpio_gecko_driver_api); \
\
static int gpio_gecko_port##pl##_init(struct device *dev) \
{ \
gpio_gecko_add_port(&gpio_gecko_common_data, dev); \
return 0; \
}

#ifdef CONFIG_GPIO_GECKO_PORTA
static int gpio_gecko_porta_init(struct device *dev);

static const struct gpio_gecko_config gpio_gecko_porta_config = {
.gpio_base = &GPIO->P[gpioPortA],
.gpio_index = gpioPortA,
};

static struct gpio_gecko_data gpio_gecko_porta_data;

DEVICE_AND_API_INIT(gpio_gecko_porta, DT_GPIO_GECKO_PORTA_NAME,
gpio_gecko_porta_init,
&gpio_gecko_porta_data, &gpio_gecko_porta_config,
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
&gpio_gecko_driver_api);

static int gpio_gecko_porta_init(struct device *dev)
{
gpio_gecko_add_port(&gpio_gecko_common_data, dev);
return 0;
}
GPIO_PORT_INIT(a, A)
#endif /* CONFIG_GPIO_GECKO_PORTA */

#ifdef CONFIG_GPIO_GECKO_PORTB
static int gpio_gecko_portb_init(struct device *dev);

static const struct gpio_gecko_config gpio_gecko_portb_config = {
.gpio_base = &GPIO->P[gpioPortB],
.gpio_index = gpioPortB,
};

static struct gpio_gecko_data gpio_gecko_portb_data;

DEVICE_AND_API_INIT(gpio_gecko_portb, DT_GPIO_GECKO_PORTB_NAME,
gpio_gecko_portb_init,
&gpio_gecko_portb_data, &gpio_gecko_portb_config,
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
&gpio_gecko_driver_api);

static int gpio_gecko_portb_init(struct device *dev)
{
gpio_gecko_add_port(&gpio_gecko_common_data, dev);
return 0;
}
GPIO_PORT_INIT(b, B)
#endif /* CONFIG_GPIO_GECKO_PORTB */

#ifdef CONFIG_GPIO_GECKO_PORTC
static int gpio_gecko_portc_init(struct device *dev);

static const struct gpio_gecko_config gpio_gecko_portc_config = {
.gpio_base = &GPIO->P[gpioPortC],
.gpio_index = gpioPortC,
};

static struct gpio_gecko_data gpio_gecko_portc_data;

DEVICE_AND_API_INIT(gpio_gecko_portc, DT_GPIO_GECKO_PORTC_NAME,
gpio_gecko_portc_init,
&gpio_gecko_portc_data, &gpio_gecko_portc_config,
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
&gpio_gecko_driver_api);

static int gpio_gecko_portc_init(struct device *dev)
{
gpio_gecko_add_port(&gpio_gecko_common_data, dev);
return 0;
}
GPIO_PORT_INIT(c, C)
#endif /* CONFIG_GPIO_GECKO_PORTC */

#ifdef CONFIG_GPIO_GECKO_PORTD
static int gpio_gecko_portd_init(struct device *dev);

static const struct gpio_gecko_config gpio_gecko_portd_config = {
.gpio_base = &GPIO->P[gpioPortD],
.gpio_index = gpioPortD,
};

static struct gpio_gecko_data gpio_gecko_portd_data;

DEVICE_AND_API_INIT(gpio_gecko_portd, DT_GPIO_GECKO_PORTD_NAME,
gpio_gecko_portd_init,
&gpio_gecko_portd_data, &gpio_gecko_portd_config,
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
&gpio_gecko_driver_api);

static int gpio_gecko_portd_init(struct device *dev)
{
gpio_gecko_add_port(&gpio_gecko_common_data, dev);
return 0;
}
GPIO_PORT_INIT(d, D)
#endif /* CONFIG_GPIO_GECKO_PORTD */

#ifdef CONFIG_GPIO_GECKO_PORTE
static int gpio_gecko_porte_init(struct device *dev);

static const struct gpio_gecko_config gpio_gecko_porte_config = {
.gpio_base = &GPIO->P[gpioPortE],
.gpio_index = gpioPortE,
};

static struct gpio_gecko_data gpio_gecko_porte_data;

DEVICE_AND_API_INIT(gpio_gecko_porte, DT_GPIO_GECKO_PORTE_NAME,
gpio_gecko_porte_init,
&gpio_gecko_porte_data, &gpio_gecko_porte_config,
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
&gpio_gecko_driver_api);

static int gpio_gecko_porte_init(struct device *dev)
{
gpio_gecko_add_port(&gpio_gecko_common_data, dev);
return 0;
}
GPIO_PORT_INIT(e, E)
#endif /* CONFIG_GPIO_GECKO_PORTE */

#ifdef CONFIG_GPIO_GECKO_PORTF
static int gpio_gecko_portf_init(struct device *dev);
GPIO_PORT_INIT(f, F)
#endif /* CONFIG_GPIO_GECKO_PORTF */

static const struct gpio_gecko_config gpio_gecko_portf_config = {
.gpio_base = &GPIO->P[gpioPortF],
.gpio_index = gpioPortF,
};
#ifdef CONFIG_GPIO_GECKO_PORTG
GPIO_PORT_INIT(g, G)
#endif /* CONFIG_GPIO_GECKO_PORTG */

static struct gpio_gecko_data gpio_gecko_portf_data;
#ifdef CONFIG_GPIO_GECKO_PORTH
GPIO_PORT_INIT(h, H)
#endif /* CONFIG_GPIO_GECKO_PORTH */

DEVICE_AND_API_INIT(gpio_gecko_portf, DT_GPIO_GECKO_PORTF_NAME,
gpio_gecko_portf_init,
&gpio_gecko_portf_data, &gpio_gecko_portf_config,
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
&gpio_gecko_driver_api);
#ifdef CONFIG_GPIO_GECKO_PORTI
GPIO_PORT_INIT(i, I)
#endif /* CONFIG_GPIO_GECKO_PORTI */

static int gpio_gecko_portf_init(struct device *dev)
{
gpio_gecko_add_port(&gpio_gecko_common_data, dev);
return 0;
}
#endif /* CONFIG_GPIO_GECKO_PORTF */
#ifdef CONFIG_GPIO_GECKO_PORTJ
GPIO_PORT_INIT(j, J)
#endif /* CONFIG_GPIO_GECKO_PORTJ */

#ifdef CONFIG_GPIO_GECKO_PORTK
GPIO_PORT_INIT(k, K)
#endif /* CONFIG_GPIO_GECKO_PORTK */
Loading