gpio: loongson-64bit: Add more gpio chip support
authorBinbin Zhou <zhoubinbin@loongson.cn>
Mon, 3 Mar 2025 07:45:52 +0000 (15:45 +0800)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Wed, 5 Mar 2025 08:55:56 +0000 (09:55 +0100)
The Loongson-7A2000 and Loongson-3A6000 share the same gpio chip model.
Just add them through driver_data.

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
Acked-by: Huacai Chen <chenhuacai@loongson.cn>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250303074552.3335186-2-zhoubinbin@loongson.cn
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
drivers/gpio/gpio-loongson-64bit.c

index f000cc0..a9a9303 100644 (file)
@@ -254,6 +254,33 @@ static const struct loongson_gpio_chip_data loongson_gpio_ls7a_data = {
        .out_offset = 0x900,
 };
 
+/* LS7A2000 chipset GPIO */
+static const struct loongson_gpio_chip_data loongson_gpio_ls7a2000_data0 = {
+       .label = "ls7a2000_gpio",
+       .mode = BYTE_CTRL_MODE,
+       .conf_offset = 0x800,
+       .in_offset = 0xa00,
+       .out_offset = 0x900,
+};
+
+/* LS7A2000 ACPI GPIO */
+static const struct loongson_gpio_chip_data loongson_gpio_ls7a2000_data1 = {
+       .label = "ls7a2000_gpio",
+       .mode = BYTE_CTRL_MODE,
+       .conf_offset = 0x4,
+       .in_offset = 0x8,
+       .out_offset = 0x0,
+};
+
+/* Loongson-3A6000 node GPIO */
+static const struct loongson_gpio_chip_data loongson_gpio_ls3a6000_data = {
+       .label = "ls3a6000_gpio",
+       .mode = BIT_CTRL_MODE,
+       .conf_offset = 0x0,
+       .in_offset = 0xc,
+       .out_offset = 0x8,
+};
+
 static const struct of_device_id loongson_gpio_of_match[] = {
        {
                .compatible = "loongson,ls2k-gpio",
@@ -287,6 +314,18 @@ static const struct of_device_id loongson_gpio_of_match[] = {
                .compatible = "loongson,ls7a-gpio",
                .data = &loongson_gpio_ls7a_data,
        },
+       {
+               .compatible = "loongson,ls7a2000-gpio1",
+               .data = &loongson_gpio_ls7a2000_data0,
+       },
+       {
+               .compatible = "loongson,ls7a2000-gpio2",
+               .data = &loongson_gpio_ls7a2000_data1,
+       },
+       {
+               .compatible = "loongson,ls3a6000-gpio",
+               .data = &loongson_gpio_ls3a6000_data,
+       },
        {}
 };
 MODULE_DEVICE_TABLE(of, loongson_gpio_of_match);
@@ -312,6 +351,18 @@ static const struct acpi_device_id loongson_gpio_acpi_match[] = {
                .id = "LOON000C",
                .driver_data = (kernel_ulong_t)&loongson_gpio_ls2k2000_data2,
        },
+       {
+               .id = "LOON000D",
+               .driver_data = (kernel_ulong_t)&loongson_gpio_ls7a2000_data0,
+       },
+       {
+               .id = "LOON000E",
+               .driver_data = (kernel_ulong_t)&loongson_gpio_ls7a2000_data1,
+       },
+       {
+               .id = "LOON000F",
+               .driver_data = (kernel_ulong_t)&loongson_gpio_ls3a6000_data,
+       },
        {}
 };
 MODULE_DEVICE_TABLE(acpi, loongson_gpio_acpi_match);