[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <jfxasie7r3362tsxscd6bqpoprsj7pgmatlj6jsfgvorkwbor3@xsikgz67p6qb>
Date: Wed, 17 Sep 2025 10:40:37 +0300
From: Ioana Ciornei <ioana.ciornei@....com>
To: Frank Li <Frank.li@....com>
Cc: Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>,
Linus Walleij <linus.walleij@...aro.org>, Bartosz Golaszewski <brgl@...ev.pl>,
Shawn Guo <shawnguo@...nel.org>, Michael Walle <mwalle@...nel.org>, Lee Jones <lee@...nel.org>,
devicetree@...r.kernel.org, linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 5/9] drivers: gpio: add QIXIS FPGA GPIO controller
On Tue, Sep 16, 2025 at 12:39:02PM -0400, Frank Li wrote:
> On Mon, Sep 15, 2025 at 03:23:50PM +0300, Ioana Ciornei wrote:
> > Add support for the GPIO controller found on some QIXIS FPGAs in
> > Layerscape boards such as LX2160ARDB and LS1046AQDS. This driver is
> > using gpio-regmap.
> >
> > A GPIO controller has a maximum of 8 lines (all found in the same
> > register). Even within the same controller, the GPIO lines' direction is
> > fixed, which mean that both input and output lines are found in the same
> > register. This is why the driver also passed to gpio-regmap the newly
> > added .fixed_direction_output bitmap to represent the true direction of
> > the lines.
> >
> > Signed-off-by: Ioana Ciornei <ioana.ciornei@....com>
> > ---
> > Changes in v2:
> > - Use the newly added .fixed_direction_output bitmap representing
> > the fixed direction of the GPIO lines.
> >
> > drivers/gpio/Kconfig | 9 +++
> > drivers/gpio/Makefile | 1 +
> > drivers/gpio/gpio-qixis-fpga.c | 123 +++++++++++++++++++++++++++++++++
> > 3 files changed, 133 insertions(+)
> > create mode 100644 drivers/gpio/gpio-qixis-fpga.c
> >
> > diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> > index 886bef9106da..4ca5890007ff 100644
> > --- a/drivers/gpio/Kconfig
> > +++ b/drivers/gpio/Kconfig
> > @@ -1951,6 +1951,15 @@ config GPIO_LATCH
> > Say yes here to enable a driver for GPIO multiplexers based on latches
> > connected to other GPIOs.
> >
> > +config GPIO_QIXIS_FPGA
> > + tristate "NXP QIXIS FPGA GPIO support"
> > + depends on MFD_SIMPLE_MFD_I2C || COMPILE_TEST
> > + select GPIO_REGMAP
> > + help
> > + This enables support for the GPIOs found in the QIXIS FPGA which is
> > + integrated on some NXP Layerscape boards such as LX2160ARDB and
> > + LS1046AQDS.
> > +
> > config GPIO_MOCKUP
> > tristate "GPIO Testing Driver (DEPRECATED)"
> > select IRQ_SIM
> > diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
> > index 379f55e9ed1e..373b1f169558 100644
> > --- a/drivers/gpio/Makefile
> > +++ b/drivers/gpio/Makefile
> > @@ -144,6 +144,7 @@ obj-$(CONFIG_GPIO_PL061) += gpio-pl061.o
> > obj-$(CONFIG_GPIO_PMIC_EIC_SPRD) += gpio-pmic-eic-sprd.o
> > obj-$(CONFIG_GPIO_POLARFIRE_SOC) += gpio-mpfs.o
> > obj-$(CONFIG_GPIO_PXA) += gpio-pxa.o
> > +obj-$(CONFIG_GPIO_QIXIS_FPGA) += gpio-qixis-fpga.o
> > obj-$(CONFIG_GPIO_RASPBERRYPI_EXP) += gpio-raspberrypi-exp.o
> > obj-$(CONFIG_GPIO_RC5T583) += gpio-rc5t583.o
> > obj-$(CONFIG_GPIO_RCAR) += gpio-rcar.o
> > diff --git a/drivers/gpio/gpio-qixis-fpga.c b/drivers/gpio/gpio-qixis-fpga.c
> > new file mode 100644
> > index 000000000000..23219a634f73
> > --- /dev/null
> > +++ b/drivers/gpio/gpio-qixis-fpga.c
> > @@ -0,0 +1,123 @@
> > +// SPDX-License-Identifier: GPL-2.0-only
> > +/*
> > + * Layerscape GPIO QIXIS FPGA driver
> > + *
> > + * Copyright 2025 NXP
> > + */
> > +
> > +#include <linux/device.h>
> > +#include <linux/gpio/driver.h>
> > +#include <linux/gpio/regmap.h>
> > +#include <linux/kernel.h>
> > +#include <linux/mod_devicetable.h>
> > +#include <linux/module.h>
> > +#include <linux/platform_device.h>
> > +#include <linux/regmap.h>
> > +
> > +enum qixis_cpld_gpio_type {
> > + LX2160ARDB_GPIO_SFP = 0,
> > + LS1046AQDS_GPIO_STAT_PRES2,
> > +};
>
> needn't type at all.
>
True, I can just pass the u64 bitmap directly as data. Will try.
[snip]
> > + if (!pdev->dev.parent)
> > + return -ENODEV;
> > +
> > + cfg = device_get_match_data(&pdev->dev);
> > + if (!cfg)
> > + return -ENODEV;
>
> Needn't this check.
Ok.
>
> > +
> > + ret = device_property_read_u32(&pdev->dev, "reg", &base);
> > + if (ret)
> > + return ret;
> > +
> > + regmap = dev_get_regmap(pdev->dev.parent, NULL);
> > + if (!regmap) {
> > + /* In case there is no regmap configured by the parent device,
> > + * create our own.
> > + */
>
> /* Use MMIO space */
Ok.
[snip]
> + config.reg_set_base = GPIO_REGMAP_ADDR(base);
>
>
> only two compatibles string in qixis_cpld_gpio_of_match. so it can set
> unconditional.
>
Fair point. Will change.
Ioana
Powered by blists - more mailing lists