All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] gpio: gpio-hisi: Add HiSilicon GPIO support
@ 2020-12-14  8:24 Luo Jiaxing
  2020-12-14  8:24 ` [PATCH v2 1/3] " Luo Jiaxing
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Luo Jiaxing @ 2020-12-14  8:24 UTC (permalink / raw)
  To: linus.walleij, bgolaszewski, catalin.marinas, will,
	andy.shevchenko, andriy.shevchenko
  Cc: linux-gpio, linux-kernel, john.garry, linuxarm

This series is the GPIO driver for HiSilicon's ARM SoC.
It provide patches for device driver, MAINTAINER file, and enable gpio-hisi
at defconfig.

Thanks
Jiaxing

---
  v1->v2: 1. set (ARM64 || COMPILE_TEST) && ACPI at kconfig.
          2. Delete some useless header files.
          3. Replace "hisi-ngpio" with "ngpios", fix firmware too
          4. Direction setting is modified to be handle by generic GPIO
          5. Add error code print
          6. Some tiny clean up
---

Luo Jiaxing (3):
  gpio: gpio-hisi: Add HiSilicon GPIO support
  MAINTAINERS: Add maintainer for HiSilicon GPIO driver
  arm64: defconfig: enable GPIO_HISI

 MAINTAINERS                  |   7 +
 arch/arm64/configs/defconfig |   1 +
 drivers/gpio/Kconfig         |  11 ++
 drivers/gpio/Makefile        |   1 +
 drivers/gpio/gpio-hisi.c     | 328 +++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 348 insertions(+)
 create mode 100644 drivers/gpio/gpio-hisi.c

-- 
2.7.4


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 1/3] gpio: gpio-hisi: Add HiSilicon GPIO support
  2020-12-14  8:24 [PATCH v2 0/3] gpio: gpio-hisi: Add HiSilicon GPIO support Luo Jiaxing
@ 2020-12-14  8:24 ` Luo Jiaxing
  2020-12-14  9:11   ` Linus Walleij
  2020-12-14 12:57   ` kernel test robot
  2020-12-14  8:24 ` [PATCH v2 2/3] MAINTAINERS: Add maintainer for HiSilicon GPIO driver Luo Jiaxing
  2020-12-14  8:24 ` [PATCH v2 3/3] arm64: defconfig: enable GPIO_HISI Luo Jiaxing
  2 siblings, 2 replies; 11+ messages in thread
From: Luo Jiaxing @ 2020-12-14  8:24 UTC (permalink / raw)
  To: linus.walleij, bgolaszewski, catalin.marinas, will,
	andy.shevchenko, andriy.shevchenko
  Cc: linux-gpio, linux-kernel, john.garry, linuxarm

This GPIO driver is for HiSilicon's ARM SoC.

HiSilicon's GPIO controller support double-edge interrupt and multi-core
concurrent access.

ACPI table example for this GPIO controller:
Device (GPO0)
{
	Name (_HID, "HISI0184")
	Device (PRTA)
	{
		Name (_ADR, Zero)
		Name (_UID, Zero)
		Name (_DSD, Package (0x01)
		{
			Package (0x02)
			{
				"ngpios",
				0x20
			}
		})
	}
}

Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com>
---
 drivers/gpio/Kconfig     |  11 ++
 drivers/gpio/Makefile    |   1 +
 drivers/gpio/gpio-hisi.c | 328 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 340 insertions(+)
 create mode 100644 drivers/gpio/gpio-hisi.c

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 5d4de5c..2598209 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -296,6 +296,17 @@ config GPIO_GRGPIO
 	  Select this to support Aeroflex Gaisler GRGPIO cores from the GRLIB
 	  VHDL IP core library.
 
+config GPIO_HISI
+	tristate "HiSilicon GPIO controller driver"
+	depends on (ARM64 || COMPILE_TEST) && ACPI
+	select GPIO_GENERIC
+	select GPIOLIB_IRQCHIP
+	help
+	  Say Y or M here to build support for the HiSilicon GPIO controller
+	  driver GPIO block.
+	  This GPIO controller support double-edge interrupt and multi-core
+	  concurrent access.
+
 config GPIO_HLWD
 	tristate "Nintendo Wii (Hollywood) GPIO"
 	depends on OF_GPIO
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 09dada8..260ae25 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -63,6 +63,7 @@ obj-$(CONFIG_GPIO_GE_FPGA)		+= gpio-ge.o
 obj-$(CONFIG_GPIO_GPIO_MM)		+= gpio-gpio-mm.o
 obj-$(CONFIG_GPIO_GRGPIO)		+= gpio-grgpio.o
 obj-$(CONFIG_GPIO_GW_PLD)		+= gpio-gw-pld.o
+obj-$(CONFIG_GPIO_HISI)                 += gpio-hisi.o
 obj-$(CONFIG_GPIO_HLWD)			+= gpio-hlwd.o
 obj-$(CONFIG_HTC_EGPIO)			+= gpio-htc-egpio.o
 obj-$(CONFIG_GPIO_ICH)			+= gpio-ich.o
diff --git a/drivers/gpio/gpio-hisi.c b/drivers/gpio/gpio-hisi.c
new file mode 100644
index 0000000..a389780
--- /dev/null
+++ b/drivers/gpio/gpio-hisi.c
@@ -0,0 +1,328 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/* Copyright (c) 2020 HiSilicon Limited. */
+#include <linux/gpio/driver.h>
+#include <linux/module.h>
+#include <linux/mod_devicetable.h>
+#include <linux/platform_device.h>
+#include <linux/property.h>
+
+#define HISI_GPIO_SWPORT_DR_SET_WX	0x000
+#define HISI_GPIO_SWPORT_DR_CLR_WX	0x004
+#define HISI_GPIO_SWPORT_DDR_SET_WX	0x010
+#define HISI_GPIO_SWPORT_DDR_CLR_WX	0x014
+#define HISI_GPIO_SWPORT_DDR_ST_WX	0x018
+#define HISI_GPIO_INTEN_SET_WX		0x020
+#define HISI_GPIO_INTEN_CLR_WX		0x024
+#define HISI_GPIO_INTMASK_SET_WX	0x030
+#define HISI_GPIO_INTMASK_CLR_WX	0x034
+#define HISI_GPIO_INTTYPE_EDGE_SET_WX	0x040
+#define HISI_GPIO_INTTYPE_EDGE_CLR_WX	0x044
+#define HISI_GPIO_INT_POLARITY_SET_WX	0x050
+#define HISI_GPIO_INT_POLARITY_CLR_WX	0x054
+#define HISI_GPIO_DEBOUNCE_SET_WX	0x060
+#define HISI_GPIO_DEBOUNCE_CLR_WX	0x064
+#define HISI_GPIO_INTSTATUS_WX		0x070
+#define HISI_GPIO_PORTA_EOI_WX		0x078
+#define HISI_GPIO_EXT_PORT_WX		0x080
+#define HISI_GPIO_INTCOMB_MASK_WX	0x0a0
+#define HISI_GPIO_INT_DEDGE_SET		0x0b0
+#define HISI_GPIO_INT_DEDGE_CLR		0x0b4
+#define HISI_GPIO_INT_DEDGE_ST		0x0b8
+
+#define HISI_GPIO_LINE_NUM_MAX	32
+#define HISI_GPIO_DRIVER_NAME	"gpio-hisi"
+
+struct hisi_gpio {
+	struct gpio_chip	chip;
+	struct device		*dev;
+	void __iomem		*reg_base;
+	unsigned int		line_num;
+	struct irq_chip		irq_chip;
+	int			irq;
+};
+
+static inline u32 hisi_gpio_read_reg(struct gpio_chip *chip,
+				     unsigned int off)
+{
+	struct hisi_gpio *hisi_gpio =
+			container_of(chip, struct hisi_gpio, chip);
+	void __iomem *reg = hisi_gpio->reg_base + off;
+
+	return readl(reg);
+}
+
+static inline void hisi_gpio_write_reg(struct gpio_chip *chip,
+				       unsigned int off, u32 val)
+{
+	struct hisi_gpio *hisi_gpio =
+			container_of(chip, struct hisi_gpio, chip);
+	void __iomem *reg = hisi_gpio->reg_base + off;
+
+	writel(val, reg);
+}
+
+static void hisi_gpio_set_debounce(struct gpio_chip *chip, unsigned int off,
+				   u32 debounce)
+{
+	if (debounce)
+		hisi_gpio_write_reg(chip, HISI_GPIO_DEBOUNCE_SET_WX, BIT(off));
+	else
+		hisi_gpio_write_reg(chip, HISI_GPIO_DEBOUNCE_CLR_WX, BIT(off));
+}
+
+static int hisi_gpio_set_config(struct gpio_chip *chip, unsigned int offset,
+				unsigned long config)
+{
+	u32 config_para = pinconf_to_config_param(config);
+	u32 config_arg;
+
+	switch (config_para) {
+	case PIN_CONFIG_INPUT_DEBOUNCE:
+		config_arg = pinconf_to_config_argument(config);
+		hisi_gpio_set_debounce(chip, offset, config_arg);
+		break;
+	default:
+		return -ENOTSUPP;
+	}
+
+	return 0;
+}
+
+static void hisi_gpio_set_ack(struct irq_data *d)
+{
+	struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
+
+	hisi_gpio_write_reg(chip, HISI_GPIO_PORTA_EOI_WX, BIT(irqd_to_hwirq(d)));
+}
+
+static void hisi_gpio_irq_set_mask(struct irq_data *d)
+{
+	struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
+
+	hisi_gpio_write_reg(chip, HISI_GPIO_INTMASK_SET_WX, BIT(irqd_to_hwirq(d)));
+}
+
+static void hisi_gpio_irq_clr_mask(struct irq_data *d)
+{
+	struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
+
+	hisi_gpio_write_reg(chip, HISI_GPIO_INTMASK_CLR_WX, BIT(irqd_to_hwirq(d)));
+}
+
+static int hisi_gpio_irq_set_type(struct irq_data *d, u32 type)
+{
+	struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
+	unsigned int mask = BIT(irqd_to_hwirq(d));
+
+	switch (type) {
+	case IRQ_TYPE_EDGE_BOTH:
+		hisi_gpio_write_reg(chip, HISI_GPIO_INT_DEDGE_SET, mask);
+		break;
+	case IRQ_TYPE_EDGE_RISING:
+		hisi_gpio_write_reg(chip, HISI_GPIO_INTTYPE_EDGE_SET_WX, mask);
+		hisi_gpio_write_reg(chip, HISI_GPIO_INT_POLARITY_SET_WX, mask);
+		break;
+	case IRQ_TYPE_EDGE_FALLING:
+		hisi_gpio_write_reg(chip, HISI_GPIO_INTTYPE_EDGE_SET_WX, mask);
+		hisi_gpio_write_reg(chip, HISI_GPIO_INT_POLARITY_CLR_WX, mask);
+		break;
+	case IRQ_TYPE_LEVEL_HIGH:
+		hisi_gpio_write_reg(chip, HISI_GPIO_INTTYPE_EDGE_CLR_WX, mask);
+		hisi_gpio_write_reg(chip, HISI_GPIO_INT_POLARITY_SET_WX, mask);
+		break;
+	case IRQ_TYPE_LEVEL_LOW:
+		hisi_gpio_write_reg(chip, HISI_GPIO_INTTYPE_EDGE_CLR_WX, mask);
+		hisi_gpio_write_reg(chip, HISI_GPIO_INT_POLARITY_CLR_WX, mask);
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	/*
+	 * The dual-edge interrupt and other interrupt's registers do not
+	 * take effect at the same time. The registers of the two-edge
+	 * interrupts have higher priorities, the configuration of
+	 * the dual-edge interrupts must be disabled before the configuration
+	 * of other kind of interrupts.
+	 */
+	if (type != IRQ_TYPE_EDGE_BOTH) {
+		unsigned int both = hisi_gpio_read_reg(chip, HISI_GPIO_INT_DEDGE_ST);
+
+		if (both & mask)
+			hisi_gpio_write_reg(chip, HISI_GPIO_INT_DEDGE_CLR, mask);
+	}
+
+	if (type & IRQ_TYPE_LEVEL_MASK)
+		irq_set_handler_locked(d, handle_level_irq);
+	else if (type & IRQ_TYPE_EDGE_BOTH)
+		irq_set_handler_locked(d, handle_edge_irq);
+
+	return 0;
+}
+
+static void hisi_gpio_irq_enable(struct irq_data *d)
+{
+	struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
+
+	hisi_gpio_irq_clr_mask(d);
+	hisi_gpio_write_reg(chip, HISI_GPIO_INTEN_SET_WX, BIT(irqd_to_hwirq(d)));
+}
+
+static void hisi_gpio_irq_disable(struct irq_data *d)
+{
+	struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
+
+	hisi_gpio_irq_set_mask(d);
+	hisi_gpio_write_reg(chip, HISI_GPIO_INTEN_CLR_WX, BIT(irqd_to_hwirq(d)));
+}
+
+static void hisi_gpio_irq_handler(struct irq_desc *desc)
+{
+	struct hisi_gpio *hisi_gpio = irq_desc_get_handler_data(desc);
+	unsigned long irq_msk = hisi_gpio_read_reg(&hisi_gpio->chip,
+						   HISI_GPIO_INTSTATUS_WX);
+	struct irq_chip *irq_c = irq_desc_get_chip(desc);
+	int hwirq;
+
+	chained_irq_enter(irq_c, desc);
+	for_each_set_bit(hwirq, &irq_msk, HISI_GPIO_LINE_NUM_MAX)
+		generic_handle_irq(irq_find_mapping(hisi_gpio->chip.irq.domain,
+						    hwirq));
+	chained_irq_exit(irq_c, desc);
+}
+
+static void hisi_gpio_init_irq(struct hisi_gpio *hisi_gpio)
+{
+	struct gpio_chip *chip = &hisi_gpio->chip;
+	struct gpio_irq_chip *girq_chip = &chip->irq;
+
+	/* Set hooks for irq_chip */
+	hisi_gpio->irq_chip.irq_ack = hisi_gpio_set_ack;
+	hisi_gpio->irq_chip.irq_mask = hisi_gpio_irq_set_mask;
+	hisi_gpio->irq_chip.irq_unmask = hisi_gpio_irq_clr_mask;
+	hisi_gpio->irq_chip.irq_set_type = hisi_gpio_irq_set_type;
+	hisi_gpio->irq_chip.irq_enable = hisi_gpio_irq_enable;
+	hisi_gpio->irq_chip.irq_disable = hisi_gpio_irq_disable;
+
+	girq_chip->chip = &hisi_gpio->irq_chip;
+	girq_chip->default_type = IRQ_TYPE_NONE;
+	girq_chip->num_parents = 1;
+	girq_chip->parents = &hisi_gpio->irq;
+	girq_chip->parent_handler = hisi_gpio_irq_handler;
+	girq_chip->parent_handler_data = hisi_gpio;
+
+	/* Clear Mask of GPIO controller combine IRQ */
+	hisi_gpio_write_reg(chip, HISI_GPIO_INTCOMB_MASK_WX, 1);
+}
+
+static const struct acpi_device_id hisi_gpio_acpi_match[] = {
+	{"HISI0184", 0},
+	{}
+};
+MODULE_DEVICE_TABLE(acpi, hisi_gpio_acpi_match);
+
+static void hisi_gpio_get_pdata(struct device *dev,
+				struct hisi_gpio *hisi_gpio)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct fwnode_handle *fwnode;
+	int idx = 0;
+
+	device_for_each_child_node(dev, fwnode)  {
+		/* Cycle for once, no need for an array to save line_num */
+		if (fwnode_property_read_u32(fwnode, "ngpios",
+					     &hisi_gpio->line_num)) {
+			dev_err(dev,
+				"failed to get number of lines for port%d and use default value instead\n",
+				idx);
+			hisi_gpio->line_num = HISI_GPIO_LINE_NUM_MAX;
+		}
+
+		if (WARN_ON(hisi_gpio->line_num > HISI_GPIO_LINE_NUM_MAX))
+			hisi_gpio->line_num = HISI_GPIO_LINE_NUM_MAX;
+
+		hisi_gpio->irq = platform_get_irq(pdev, idx);
+
+		dev_info(dev,
+			 "get hisi_gpio[%d] with %d lines\n", idx,
+			 hisi_gpio->line_num);
+
+		idx++;
+	}
+}
+
+static int hisi_gpio_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	void __iomem *dat, *set, *clr;
+	struct hisi_gpio *hisi_gpio;
+	int port_num;
+	int ret;
+
+	/*
+	 * One GPIO controller own one port currently,
+	 * if we get more from ACPI table, return error.
+	 */
+	port_num = device_get_child_node_count(dev);
+	if (WARN_ON(port_num != 1))
+		return -ENODEV;
+
+	hisi_gpio = devm_kzalloc(dev, sizeof(*hisi_gpio), GFP_KERNEL);
+	if (!hisi_gpio)
+		return -ENOMEM;
+
+	hisi_gpio->reg_base = devm_platform_ioremap_resource(pdev, 0);
+	if (IS_ERR(hisi_gpio->reg_base))
+		return PTR_ERR(hisi_gpio->reg_base);
+
+	hisi_gpio_get_pdata(dev, hisi_gpio);
+
+	hisi_gpio->dev = dev;
+
+	dat = hisi_gpio->reg_base + HISI_GPIO_EXT_PORT_WX;
+	set = hisi_gpio->reg_base + HISI_GPIO_SWPORT_DR_SET_WX;
+	clr = hisi_gpio->reg_base + HISI_GPIO_SWPORT_DR_CLR_WX;
+
+	ret = bgpio_init(&hisi_gpio->chip, hisi_gpio->dev, 0x4,
+			 hisi_gpio->reg_base + HISI_GPIO_EXT_PORT_WX,
+			 hisi_gpio->reg_base + HISI_GPIO_SWPORT_DR_SET_WX,
+			 hisi_gpio->reg_base + HISI_GPIO_SWPORT_DR_CLR_WX,
+			 hisi_gpio->reg_base + HISI_GPIO_SWPORT_DDR_SET_WX,
+			 hisi_gpio->reg_base + HISI_GPIO_SWPORT_DDR_CLR_WX,
+			 BGPIOF_NO_SET_ON_INPUT);
+	if (ret) {
+		dev_err(dev, "failed to init, ret = %d\n", ret);
+		return ret;
+	}
+
+	hisi_gpio->chip.set_config = hisi_gpio_set_config;
+	hisi_gpio->chip.ngpio = hisi_gpio->line_num;
+	hisi_gpio->chip.bgpio_dir_unreadable = 1;
+	hisi_gpio->chip.base = -1;
+
+	if (hisi_gpio->irq > 0)
+		hisi_gpio_init_irq(hisi_gpio);
+
+	ret = devm_gpiochip_add_data(dev, &hisi_gpio->chip, hisi_gpio);
+	if (ret) {
+		dev_err(dev, "failed to register gpiochip, ret = %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+static struct platform_driver hisi_gpio_driver = {
+	.driver		= {
+		.name	= HISI_GPIO_DRIVER_NAME,
+		.acpi_match_table = hisi_gpio_acpi_match,
+	},
+	.probe		= hisi_gpio_probe,
+};
+
+module_platform_driver(hisi_gpio_driver);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Luo Jiaxing <luojiaxing@huawei.com>");
+MODULE_DESCRIPTION("HiSilicon GPIO controller driver");
+MODULE_ALIAS("platform:" HISI_GPIO_DRIVER_NAME);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 2/3] MAINTAINERS: Add maintainer for HiSilicon GPIO driver
  2020-12-14  8:24 [PATCH v2 0/3] gpio: gpio-hisi: Add HiSilicon GPIO support Luo Jiaxing
  2020-12-14  8:24 ` [PATCH v2 1/3] " Luo Jiaxing
@ 2020-12-14  8:24 ` Luo Jiaxing
  2020-12-14  9:11   ` Linus Walleij
  2020-12-14  8:24 ` [PATCH v2 3/3] arm64: defconfig: enable GPIO_HISI Luo Jiaxing
  2 siblings, 1 reply; 11+ messages in thread
From: Luo Jiaxing @ 2020-12-14  8:24 UTC (permalink / raw)
  To: linus.walleij, bgolaszewski, catalin.marinas, will,
	andy.shevchenko, andriy.shevchenko
  Cc: linux-gpio, linux-kernel, john.garry, linuxarm

Here add maintainer information for HiSilicon GPIO driver.

Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com>
---
 MAINTAINERS | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 2daa6ee..8d13419a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7896,6 +7896,13 @@ L:	dmaengine@vger.kernel.org
 S:	Maintained
 F:	drivers/dma/hisi_dma.c
 
+HISILICON GPIO DRIVER
+M:	Luo Jiaxing <luojiaxing@huawei.com>
+L:	linux-gpio@vger.kernel.org
+S:	Maintained
+F:	drivers/gpio/gpio-hisi.c
+F:	include/linux/platform_data/gpio-hisi.h
+
 HISILICON HIGH PERFORMANCE RSA ENGINE DRIVER (HPRE)
 M:	Zaibo Xu <xuzaibo@huawei.com>
 L:	linux-crypto@vger.kernel.org
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 3/3] arm64: defconfig: enable GPIO_HISI
  2020-12-14  8:24 [PATCH v2 0/3] gpio: gpio-hisi: Add HiSilicon GPIO support Luo Jiaxing
  2020-12-14  8:24 ` [PATCH v2 1/3] " Luo Jiaxing
  2020-12-14  8:24 ` [PATCH v2 2/3] MAINTAINERS: Add maintainer for HiSilicon GPIO driver Luo Jiaxing
@ 2020-12-14  8:24 ` Luo Jiaxing
  2020-12-14  9:12   ` Linus Walleij
  2 siblings, 1 reply; 11+ messages in thread
From: Luo Jiaxing @ 2020-12-14  8:24 UTC (permalink / raw)
  To: linus.walleij, bgolaszewski, catalin.marinas, will,
	andy.shevchenko, andriy.shevchenko
  Cc: linux-gpio, linux-kernel, john.garry, linuxarm

Enable GPIO controller for HiSilicon's ARM SoC.

GPIO is common driver for HiSilicon's ARM SoC and it provide support for
some function of I2C and SPI.

Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com>
---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 5cfe3cf..b5cdf5e 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -498,6 +498,7 @@ CONFIG_PINCTRL_SM8150=y
 CONFIG_PINCTRL_SM8250=y
 CONFIG_GPIO_ALTERA=m
 CONFIG_GPIO_DWAPB=y
+CONFIG_GPIO_HISI=y
 CONFIG_GPIO_MB86S7X=y
 CONFIG_GPIO_MPC8XXX=y
 CONFIG_GPIO_MXC=y
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 1/3] gpio: gpio-hisi: Add HiSilicon GPIO support
  2020-12-14  8:24 ` [PATCH v2 1/3] " Luo Jiaxing
@ 2020-12-14  9:11   ` Linus Walleij
  2020-12-14 16:58     ` Andy Shevchenko
  2020-12-14 12:57   ` kernel test robot
  1 sibling, 1 reply; 11+ messages in thread
From: Linus Walleij @ 2020-12-14  9:11 UTC (permalink / raw)
  To: Luo Jiaxing
  Cc: Bartosz Golaszewski, Catalin Marinas, Will Deacon,
	Andy Shevchenko, Andy Shevchenko, open list:GPIO SUBSYSTEM,
	linux-kernel, John Garry, Linuxarm

On Mon, Dec 14, 2020 at 9:24 AM Luo Jiaxing <luojiaxing@huawei.com> wrote:

> This GPIO driver is for HiSilicon's ARM SoC.

Patch applied, any further issues can certainly be fixed in-tree.
Thanks for your excellent work on this driver!

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 2/3] MAINTAINERS: Add maintainer for HiSilicon GPIO driver
  2020-12-14  8:24 ` [PATCH v2 2/3] MAINTAINERS: Add maintainer for HiSilicon GPIO driver Luo Jiaxing
@ 2020-12-14  9:11   ` Linus Walleij
  0 siblings, 0 replies; 11+ messages in thread
From: Linus Walleij @ 2020-12-14  9:11 UTC (permalink / raw)
  To: Luo Jiaxing
  Cc: Bartosz Golaszewski, Catalin Marinas, Will Deacon,
	Andy Shevchenko, Andy Shevchenko, open list:GPIO SUBSYSTEM,
	linux-kernel, John Garry, Linuxarm

On Mon, Dec 14, 2020 at 9:24 AM Luo Jiaxing <luojiaxing@huawei.com> wrote:

> Here add maintainer information for HiSilicon GPIO driver.
>
> Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com>

Patch applied!

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 3/3] arm64: defconfig: enable GPIO_HISI
  2020-12-14  8:24 ` [PATCH v2 3/3] arm64: defconfig: enable GPIO_HISI Luo Jiaxing
@ 2020-12-14  9:12   ` Linus Walleij
  0 siblings, 0 replies; 11+ messages in thread
From: Linus Walleij @ 2020-12-14  9:12 UTC (permalink / raw)
  To: Luo Jiaxing
  Cc: Bartosz Golaszewski, Catalin Marinas, Will Deacon,
	Andy Shevchenko, Andy Shevchenko, open list:GPIO SUBSYSTEM,
	linux-kernel, John Garry, Linuxarm

On Mon, Dec 14, 2020 at 9:24 AM Luo Jiaxing <luojiaxing@huawei.com> wrote:

> Enable GPIO controller for HiSilicon's ARM SoC.
>
> GPIO is common driver for HiSilicon's ARM SoC and it provide support for
> some function of I2C and SPI.
>
> Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com>

Looks good, take this through the SoC tree with other platform support.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 1/3] gpio: gpio-hisi: Add HiSilicon GPIO support
  2020-12-14  8:24 ` [PATCH v2 1/3] " Luo Jiaxing
  2020-12-14  9:11   ` Linus Walleij
@ 2020-12-14 12:57   ` kernel test robot
  1 sibling, 0 replies; 11+ messages in thread
From: kernel test robot @ 2020-12-14 12:57 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4463 bytes --]

Hi Luo,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on gpio/for-next]
[also build test WARNING on arm64/for-next/core linus/master v5.10 next-20201211]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Luo-Jiaxing/gpio-gpio-hisi-Add-HiSilicon-GPIO-support/20201214-163229
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git for-next
config: ia64-allyesconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/a5a4b0b963f551e72877f5a6ed97657ebf074449
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Luo-Jiaxing/gpio-gpio-hisi-Add-HiSilicon-GPIO-support/20201214-163229
        git checkout a5a4b0b963f551e72877f5a6ed97657ebf074449
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=ia64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/gpio/gpio-hisi.c: In function 'hisi_gpio_probe':
>> drivers/gpio/gpio-hisi.c:257:28: warning: variable 'clr' set but not used [-Wunused-but-set-variable]
     257 |  void __iomem *dat, *set, *clr;
         |                            ^~~
>> drivers/gpio/gpio-hisi.c:257:22: warning: variable 'set' set but not used [-Wunused-but-set-variable]
     257 |  void __iomem *dat, *set, *clr;
         |                      ^~~
>> drivers/gpio/gpio-hisi.c:257:16: warning: variable 'dat' set but not used [-Wunused-but-set-variable]
     257 |  void __iomem *dat, *set, *clr;
         |                ^~~

vim +/clr +257 drivers/gpio/gpio-hisi.c

   253	
   254	static int hisi_gpio_probe(struct platform_device *pdev)
   255	{
   256		struct device *dev = &pdev->dev;
 > 257		void __iomem *dat, *set, *clr;
   258		struct hisi_gpio *hisi_gpio;
   259		int port_num;
   260		int ret;
   261	
   262		/*
   263		 * One GPIO controller own one port currently,
   264		 * if we get more from ACPI table, return error.
   265		 */
   266		port_num = device_get_child_node_count(dev);
   267		if (WARN_ON(port_num != 1))
   268			return -ENODEV;
   269	
   270		hisi_gpio = devm_kzalloc(dev, sizeof(*hisi_gpio), GFP_KERNEL);
   271		if (!hisi_gpio)
   272			return -ENOMEM;
   273	
   274		hisi_gpio->reg_base = devm_platform_ioremap_resource(pdev, 0);
   275		if (IS_ERR(hisi_gpio->reg_base))
   276			return PTR_ERR(hisi_gpio->reg_base);
   277	
   278		hisi_gpio_get_pdata(dev, hisi_gpio);
   279	
   280		hisi_gpio->dev = dev;
   281	
   282		dat = hisi_gpio->reg_base + HISI_GPIO_EXT_PORT_WX;
   283		set = hisi_gpio->reg_base + HISI_GPIO_SWPORT_DR_SET_WX;
   284		clr = hisi_gpio->reg_base + HISI_GPIO_SWPORT_DR_CLR_WX;
   285	
   286		ret = bgpio_init(&hisi_gpio->chip, hisi_gpio->dev, 0x4,
   287				 hisi_gpio->reg_base + HISI_GPIO_EXT_PORT_WX,
   288				 hisi_gpio->reg_base + HISI_GPIO_SWPORT_DR_SET_WX,
   289				 hisi_gpio->reg_base + HISI_GPIO_SWPORT_DR_CLR_WX,
   290				 hisi_gpio->reg_base + HISI_GPIO_SWPORT_DDR_SET_WX,
   291				 hisi_gpio->reg_base + HISI_GPIO_SWPORT_DDR_CLR_WX,
   292				 BGPIOF_NO_SET_ON_INPUT);
   293		if (ret) {
   294			dev_err(dev, "failed to init, ret = %d\n", ret);
   295			return ret;
   296		}
   297	
   298		hisi_gpio->chip.set_config = hisi_gpio_set_config;
   299		hisi_gpio->chip.ngpio = hisi_gpio->line_num;
   300		hisi_gpio->chip.bgpio_dir_unreadable = 1;
   301		hisi_gpio->chip.base = -1;
   302	
   303		if (hisi_gpio->irq > 0)
   304			hisi_gpio_init_irq(hisi_gpio);
   305	
   306		ret = devm_gpiochip_add_data(dev, &hisi_gpio->chip, hisi_gpio);
   307		if (ret) {
   308			dev_err(dev, "failed to register gpiochip, ret = %d\n", ret);
   309			return ret;
   310		}
   311	
   312		return 0;
   313	}
   314	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 67918 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 1/3] gpio: gpio-hisi: Add HiSilicon GPIO support
  2020-12-14  9:11   ` Linus Walleij
@ 2020-12-14 16:58     ` Andy Shevchenko
  2020-12-14 22:37       ` Linus Walleij
  0 siblings, 1 reply; 11+ messages in thread
From: Andy Shevchenko @ 2020-12-14 16:58 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Luo Jiaxing, Bartosz Golaszewski, Catalin Marinas, Will Deacon,
	open list:GPIO SUBSYSTEM, linux-kernel, John Garry, Linuxarm

On Mon, Dec 14, 2020 at 10:11:23AM +0100, Linus Walleij wrote:
> On Mon, Dec 14, 2020 at 9:24 AM Luo Jiaxing <luojiaxing@huawei.com> wrote:
> 
> > This GPIO driver is for HiSilicon's ARM SoC.
> 
> Patch applied, any further issues can certainly be fixed in-tree.

I just sent two :-)

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 1/3] gpio: gpio-hisi: Add HiSilicon GPIO support
  2020-12-14 16:58     ` Andy Shevchenko
@ 2020-12-14 22:37       ` Linus Walleij
  2020-12-15  9:49         ` Andy Shevchenko
  0 siblings, 1 reply; 11+ messages in thread
From: Linus Walleij @ 2020-12-14 22:37 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Luo Jiaxing, Bartosz Golaszewski, Catalin Marinas, Will Deacon,
	open list:GPIO SUBSYSTEM, linux-kernel, John Garry, Linuxarm

On Mon, Dec 14, 2020 at 5:57 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Mon, Dec 14, 2020 at 10:11:23AM +0100, Linus Walleij wrote:
> > On Mon, Dec 14, 2020 at 9:24 AM Luo Jiaxing <luojiaxing@huawei.com> wrote:
> >
> > > This GPIO driver is for HiSilicon's ARM SoC.
> >
> > Patch applied, any further issues can certainly be fixed in-tree.
>
> I just sent two :-)

Thanks Andy!

Actually I kind like this in a way because then you also get some
credit for the heavy review work that you do on new drivers and
so often go uncredited.

I'm sometimes tempted to even add "Co-developed-by" for the
vast improvements you bring up. (Like on my YAS530 driver.)

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 1/3] gpio: gpio-hisi: Add HiSilicon GPIO support
  2020-12-14 22:37       ` Linus Walleij
@ 2020-12-15  9:49         ` Andy Shevchenko
  0 siblings, 0 replies; 11+ messages in thread
From: Andy Shevchenko @ 2020-12-15  9:49 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Luo Jiaxing, Bartosz Golaszewski, Catalin Marinas, Will Deacon,
	open list:GPIO SUBSYSTEM, linux-kernel, John Garry, Linuxarm

On Tue, Dec 15, 2020 at 12:37 AM Linus Walleij <linus.walleij@linaro.org> wrote:
> On Mon, Dec 14, 2020 at 5:57 PM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
> > On Mon, Dec 14, 2020 at 10:11:23AM +0100, Linus Walleij wrote:
> > > On Mon, Dec 14, 2020 at 9:24 AM Luo Jiaxing <luojiaxing@huawei.com> wrote:
> > >
> > > > This GPIO driver is for HiSilicon's ARM SoC.
> > >
> > > Patch applied, any further issues can certainly be fixed in-tree.
> >
> > I just sent two :-)
>
> Thanks Andy!
>
> Actually I kind like this in a way because then you also get some
> credit for the heavy review work that you do on new drivers and
> so often go uncredited.

You are welcome!

> I'm sometimes tempted to even add "Co-developed-by" for the
> vast improvements you bring up. (Like on my YAS530 driver.)

With the CdB tag the SoB must go (per documentation) and I can't give
you the latter one for your contribution for obvious reasons. OTOH
feel free to give credit in a free form in the cover letter / commit
message if you think it's good to have.

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-12-15  9:49 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-14  8:24 [PATCH v2 0/3] gpio: gpio-hisi: Add HiSilicon GPIO support Luo Jiaxing
2020-12-14  8:24 ` [PATCH v2 1/3] " Luo Jiaxing
2020-12-14  9:11   ` Linus Walleij
2020-12-14 16:58     ` Andy Shevchenko
2020-12-14 22:37       ` Linus Walleij
2020-12-15  9:49         ` Andy Shevchenko
2020-12-14 12:57   ` kernel test robot
2020-12-14  8:24 ` [PATCH v2 2/3] MAINTAINERS: Add maintainer for HiSilicon GPIO driver Luo Jiaxing
2020-12-14  9:11   ` Linus Walleij
2020-12-14  8:24 ` [PATCH v2 3/3] arm64: defconfig: enable GPIO_HISI Luo Jiaxing
2020-12-14  9:12   ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.