[openwrt/openwrt] siflower: add ngpios property to gpio-siflower
LEDE Commits
lede-commits at lists.infradead.org
Tue Feb 4 19:09:02 PST 2025
981213 pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/274df8eedb5863900934a8c5bda3e376f2d7c144
commit 274df8eedb5863900934a8c5bda3e376f2d7c144
Author: Chuanhong Guo <gch981213 at gmail.com>
AuthorDate: Tue Oct 8 14:16:15 2024 +0800
siflower: add ngpios property to gpio-siflower
The same GPIO controller is found on all current Siflower SoCs,
with different number of GPIOs. Add ngpios property instead of
specifying it with dt match data.
Link: https://github.com/openwrt/openwrt/pull/17115
Signed-off-by: Chuanhong Guo <gch981213 at gmail.com>
---
target/linux/siflower/dts/sf19a2890.dtsi | 1 +
target/linux/siflower/files-6.6/drivers/gpio/gpio-siflower.c | 7 +++++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/target/linux/siflower/dts/sf19a2890.dtsi b/target/linux/siflower/dts/sf19a2890.dtsi
index b8f1cec83e..645cb8beb2 100644
--- a/target/linux/siflower/dts/sf19a2890.dtsi
+++ b/target/linux/siflower/dts/sf19a2890.dtsi
@@ -232,6 +232,7 @@
gpio-controller;
#gpio-cells = <2>;
+ ngpios = <49>;
gpio-ranges = <&pinctrl 0 0 49>;
interrupt-controller;
diff --git a/target/linux/siflower/files-6.6/drivers/gpio/gpio-siflower.c b/target/linux/siflower/files-6.6/drivers/gpio/gpio-siflower.c
index bd3d8906b4..4253a84bf4 100644
--- a/target/linux/siflower/files-6.6/drivers/gpio/gpio-siflower.c
+++ b/target/linux/siflower/files-6.6/drivers/gpio/gpio-siflower.c
@@ -255,7 +255,10 @@ static int sf_gpio_probe(struct platform_device *pdev)
u32 ngpios, ngroups;
int ret, i;
- ngpios = (unsigned int) device_get_match_data(dev);
+ ret = of_property_read_u32(pdev->dev.of_node, "ngpios", &ngpios);
+ if (ret)
+ return ret;
+
ngroups = DIV_ROUND_UP(ngpios, GPIOS_PER_GROUP);
priv = devm_kzalloc(dev, struct_size(priv, irq, ngroups), GFP_KERNEL);
if (!priv)
@@ -323,7 +326,7 @@ static int sf_gpio_remove(struct platform_device *pdev)
}
static const struct of_device_id sf_gpio_ids[] = {
- { .compatible = "siflower,sf19a2890-gpio", .data = (void *)49 },
+ { .compatible = "siflower,sf19a2890-gpio" },
{},
};
MODULE_DEVICE_TABLE(of, sf_gpio_ids);
More information about the lede-commits
mailing list