On Mon, Mar 3, 2025 at 8:46 AM Binbin Zhou <zhoubinbin@xxxxxxxxxxx> wrote: > > The Loongson-7A2000 and Loongson-3A6000 share the same gpio chip model. > Just add them through driver_data. > > Signed-off-by: Binbin Zhou <zhoubinbin@xxxxxxxxxxx> > --- > drivers/gpio/gpio-loongson-64bit.c | 51 ++++++++++++++++++++++++++++++ > 1 file changed, 51 insertions(+) > > diff --git a/drivers/gpio/gpio-loongson-64bit.c b/drivers/gpio/gpio-loongson-64bit.c > index f000cc0356c7..a9a93036f08f 100644 > --- a/drivers/gpio/gpio-loongson-64bit.c > +++ b/drivers/gpio/gpio-loongson-64bit.c > @@ -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, > +}; The naming convention here is a bit confusing, can't we have the naming of variables reflect the compatibles they refer to? Bart > + > +/* 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); > -- > 2.47.1 >