[PATCH v1 0/2] riscv: add GPIO support for the LicheePi4A

From: Maksim Kiselev bigunclemax@gmail.com
This series adds GPIO support for the LicheePi4A board. It's based on Alibaba TH1520 SoC that has DesignWare APB GPIO controller.
Best regards, Maksim
Maksim Kiselev (2): gpio: dw: Add ngpios DT-property support configs: th1520_lpi4a: Enable CMD_GPIO, DM_GPIO and DWAPB_GPIO driver
configs/th1520_lpi4a_defconfig | 4 +++- drivers/gpio/dwapb_gpio.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)

From: Maksim Kiselev bigunclemax@gmail.com
Starting with Linux commit 7569486d79ae ("gpio: dwapb: Add ngpios DT-property support") the "snps,nr-gpios" property was marked as deprecated.
And since all newly added dw-apb-gpio nodes are described using generic "ngpios" property, it's time to add support for it.
Signed-off-by: Maksim Kiselev bigunclemax@gmail.com --- drivers/gpio/dwapb_gpio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/dwapb_gpio.c b/drivers/gpio/dwapb_gpio.c index 7a6eae9ba1..04639a4cb6 100644 --- a/drivers/gpio/dwapb_gpio.c +++ b/drivers/gpio/dwapb_gpio.c @@ -177,7 +177,9 @@ static int gpio_dwapb_bind(struct udevice *dev)
plat->base = (void *)base; plat->bank = bank; - plat->pins = ofnode_read_u32_default(node, "snps,nr-gpios", 0); + + if (ofnode_read_u32(node, "ngpios", &plat->pins)) + plat->pins = ofnode_read_u32_default(node, "snps,nr-gpios", 0);
if (ofnode_read_string_index(node, "bank-name", 0, &plat->name)) {

On Fri, Sep 20, 2024 at 12:05:23PM +0300, bigunclemax@gmail.com wrote:
From: Maksim Kiselev bigunclemax@gmail.com
Starting with Linux commit 7569486d79ae ("gpio: dwapb: Add ngpios DT-property support") the "snps,nr-gpios" property was marked as deprecated.
And since all newly added dw-apb-gpio nodes are described using generic "ngpios" property, it's time to add support for it.
Signed-off-by: Maksim Kiselev bigunclemax@gmail.com
drivers/gpio/dwapb_gpio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Reviewed-by: Leo Yu-Chi Liang ycliang@andestech.com

From: Maksim Kiselev bigunclemax@gmail.com
Enable GPIO command and DWAPB_GPIO driver for LicheePi4A board.
Signed-off-by: Maksim Kiselev bigunclemax@gmail.com --- configs/th1520_lpi4a_defconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/configs/th1520_lpi4a_defconfig b/configs/th1520_lpi4a_defconfig index db80e33870..bcb22730be 100644 --- a/configs/th1520_lpi4a_defconfig +++ b/configs/th1520_lpi4a_defconfig @@ -4,6 +4,7 @@ CONFIG_SYS_MALLOC_F_LEN=0x3000 CONFIG_NR_DRAM_BANKS=1 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80200000 +CONFIG_DM_GPIO=y CONFIG_DEFAULT_DEVICE_TREE="th1520-lichee-pi-4a" CONFIG_SYS_LOAD_ADDR=0x80200000 # CONFIG_SMP is not set @@ -49,6 +50,7 @@ CONFIG_CMD_BOOTMENU=y # CONFIG_CMD_LZMADEC is not set # CONFIG_CMD_UNLZ4 is not set # CONFIG_CMD_UNZIP is not set +CONFIG_CMD_GPIO=y # CONFIG_CMD_LOADB is not set # CONFIG_CMD_LOADS is not set # CONFIG_CMD_ITEST is not set @@ -60,7 +62,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_VERSION_VARIABLE=y # CONFIG_NET is not set # CONFIG_BLOCK_CACHE is not set -# CONFIG_GPIO is not set +CONFIG_DWAPB_GPIO=y # CONFIG_I2C is not set # CONFIG_INPUT is not set # CONFIG_DM_MMC is not set

On Fri, Sep 20, 2024 at 12:05:24PM +0300, bigunclemax@gmail.com wrote:
From: Maksim Kiselev bigunclemax@gmail.com
Enable GPIO command and DWAPB_GPIO driver for LicheePi4A board.
Signed-off-by: Maksim Kiselev bigunclemax@gmail.com
configs/th1520_lpi4a_defconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Reviewed-by: Leo Yu-Chi Liang ycliang@andestech.com
participants (2)
-
bigunclemax@gmail.com
-
Leo Liang