Skip to contentSkip to conversation

riscv: add GPIO support for the LicheePi4A

PATCH In review [email protected] 2 participants 5 messages Sep 20, 2024 – Sep 24, 2024 GPIO

lore
Share & tools
lore
#0 lore raw

cover riscv: add GPIO support for the LicheePi4A

From: Maksim Kiselev <[email protected]>

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(-)
Signature · 1 line
2.45.2
#1 lore raw

PATCH 1/2 gpio: dw: Add ngpios DT-property support

From: Maksim Kiselev <[email protected]>

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.

---
 drivers/gpio/dwapb_gpio.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpio/dwapb_gpio.c +3 -1
index 7a6eae9ba1..04639a4cb6 100644
@@ -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)) {
Signature · 1 line
2.45.2
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH v1 1/2] gpio: dw: Add ngpios DT-property support

Quoted 6 lines · On Fri, Sep 20, 2024 at 12:05:23PM +0300, [email protected] wrote:

From: Maksim Kiselev <[email protected]>

Starting with Linux commit 7569486d79ae ("gpio: dwapb: Add ngpios DT-property support") the "snps,nr-gpios" property was marked as deprecated.

Quoted 7 lines

And since all newly added dw-apb-gpio nodes are described using generic "ngpios" property, it's time to add support for it.

---
 drivers/gpio/dwapb_gpio.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
#3 lore raw

PATCH 2/2 configs: th1520_lpi4a: Enable CMD_GPIO, DM_GPIO and DWAPB_GPIO driver

In reply to [email protected]

From: Maksim Kiselev <[email protected]>

Enable GPIO command and DWAPB_GPIO driver for LicheePi4A board.

---
 configs/th1520_lpi4a_defconfig | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
configs/th1520_lpi4a_defconfig +3 -1
index db80e33870..bcb22730be 100644
@@ -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
Signature · 1 line
2.45.2
Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH v1 2/2] configs: th1520_lpi4a: Enable CMD_GPIO, DM_GPIO and DWAPB_GPIO driver

Quoted 8 lines · On Fri, Sep 20, 2024 at 12:05:24PM +0300, [email protected] wrote:

From: Maksim Kiselev <[email protected]>

Enable GPIO command and DWAPB_GPIO driver for LicheePi4A board.

---
 configs/th1520_lpi4a_defconfig | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)