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
5 changes: 5 additions & 0 deletions boards/arm/gd32f403z_eval/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ The board configuration supports the following hardware features:
+-----------+------------+-----------------------+
| Interface | Controller | Driver/Component |
+===========+============+=======================+
| EXTI | on-chip | EXTI interrupt |
| | | controller |
+-----------+------------+-----------------------+
| GPIO | on-chip | gpio |
+-----------+------------+-----------------------+
| NVIC | on-chip | nested vectored |
| | | interrupt controller |
+-----------+------------+-----------------------+
Expand Down
58 changes: 58 additions & 0 deletions boards/arm/gd32f403z_eval/gd32f403z_eval.dts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,64 @@
zephyr,console = &usart0;
zephyr,shell-uart = &usart0;
};

leds {
compatible = "gpio-leds";
led2: led2 {
gpios = <&gpiof 0 GPIO_ACTIVE_HIGH>;
label = "LED2";
};
led3: led3 {
gpios = <&gpiof 1 GPIO_ACTIVE_HIGH>;
label = "LED3";
};
led4: led4 {
gpios = <&gpiof 2 GPIO_ACTIVE_HIGH>;
label = "LED4";
};
led5: led5 {
gpios = <&gpiof 3 GPIO_ACTIVE_HIGH>;
label = "LED5";
};
};

gpio_keys {
compatible = "gpio-keys";
wakeup_key: wakeup_key {
label = "WAKEUP_KEY";
gpios = <&gpioa 0 GPIO_ACTIVE_LOW>;
};
tamper_key: tamper_key {
label = "TAMPER_KEY";
gpios = <&gpioc 13 GPIO_ACTIVE_LOW>;
};
user_key1: user_key1 {
label = "USER_KEY1";
gpios = <&gpiof 5 GPIO_ACTIVE_LOW>;
};
user_key2: user_key2 {
label = "USER_KEY2";
gpios = <&gpiof 4 GPIO_ACTIVE_LOW>;
};
};

aliases {
led0 = &led2;
led1 = &led3;
sw0 = &user_key1;
};
};

&gpioa {
status = "okay";
};

&gpioc {
status = "okay";
};

&gpiof {
status = "okay";
};

&usart0 {
Expand Down
2 changes: 2 additions & 0 deletions boards/arm/gd32f403z_eval/gd32f403z_eval_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ CONFIG_CORTEX_M_SYSTICK=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_SERIAL=y

CONFIG_GPIO=y
6 changes: 6 additions & 0 deletions boards/arm/gd32f450i_eval/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ The board configuration supports the following hardware features:
* - Peripheral
- Kconfig option
- Devicetree compatible
* - EXTI
- :kconfig:`CONFIG_GD32_EXTI`
- :dtcompatible:`gd,gd32-exti`
* - GPIO
- :kconfig:`CONFIG_GPIO`
- :dtcompatible:`gd,gd32-gpio`
* - NVIC
- N/A
- :dtcompatible:`arm,v7m-nvic`
Expand Down
58 changes: 58 additions & 0 deletions boards/arm/gd32f450i_eval/gd32f450i_eval.dts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,64 @@
zephyr,console = &usart0;
zephyr,shell-uart = &usart0;
};

leds {
compatible = "gpio-leds";
led1: led1 {
gpios = <&gpioe 2 GPIO_ACTIVE_HIGH>;
label = "LED1";
};
led2: led2 {
gpios = <&gpioe 3 GPIO_ACTIVE_HIGH>;
label = "LED2";
};
led3: led3 {
gpios = <&gpiof 10 GPIO_ACTIVE_HIGH>;
label = "LED3";
};
};

gpio_keys {
compatible = "gpio-keys";
wakeup_key: wakeup_key {
label = "WAKEUP_KEY";
gpios = <&gpioa 0 GPIO_ACTIVE_LOW>;
};
tamper_key: tamper_key {
label = "TAMPER_KEY";
gpios = <&gpioc 13 GPIO_ACTIVE_LOW>;
};
user_key: user_key {
label = "USER_KEY";
gpios = <&gpiob 14 GPIO_ACTIVE_LOW>;
};
};

aliases {
led0 = &led1;
led1 = &led2;
sw0 = &user_key;
};
};

&gpioa {
status = "okay";
};

&gpiob {
status = "okay";
};

&gpioc {
status = "okay";
};

&gpioe {
status = "okay";
};

&gpiof {
status = "okay";
};

&usart0 {
Expand Down
2 changes: 2 additions & 0 deletions boards/arm/gd32f450i_eval/gd32f450i_eval_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ CONFIG_CORTEX_M_SYSTICK=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_SERIAL=y

CONFIG_GPIO=y
2 changes: 1 addition & 1 deletion drivers/gpio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ zephyr_library_sources_ifdef(CONFIG_GPIO_NCT38XX gpio_nct38xx.c)
zephyr_library_sources_ifdef(CONFIG_GPIO_NCT38XX gpio_nct38xx_port.c)
zephyr_library_sources_ifdef(CONFIG_GPIO_NCT38XX_INTERRUPT gpio_nct38xx_alert.c)
zephyr_library_sources_ifdef(CONFIG_GPIO_TEST gpio_test.c)

zephyr_library_sources_ifdef(CONFIG_GPIO_GD32 gpio_gd32.c)

zephyr_library_sources_ifdef(CONFIG_GPIO_SHELL gpio_shell.c)

Expand Down
2 changes: 2 additions & 0 deletions drivers/gpio/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,6 @@ source "drivers/gpio/Kconfig.nct38xx"

source "drivers/gpio/Kconfig.test"

source "drivers/gpio/Kconfig.gd32"

endif # GPIO
11 changes: 11 additions & 0 deletions drivers/gpio/Kconfig.gd32
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright (c) 2021 Teslabs Engineering S.L.
# SPDX-License-Identifier: Apache-2.0

DT_COMPAT_GD_GD32_GPIO := gd,gd32-gpio

config GPIO_GD32
bool "GD32 GPIO driver"
depends on SOC_FAMILY_GD32
default $(dt_compat_enabled,$(DT_COMPAT_GD_GD32_GPIO))
help
Enable the GD32 GPIO driver.
Loading