gpio: add support for Phytium platform GPIO controller
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/3 dt-bindings: gpio: add Phytium GPIO controller
Add the devicetree binding schema for the Phytium platform GPIO controller.
Register the "phytium" vendor prefix used by the compatible string.
Use ngpios as the preferred child-node property and keep nr-gpios as deprecated for compatibility with existing firmware descriptions.
--- .../bindings/gpio/phytium,gpio.yaml | 134 ++++++++++++++++++ .../devicetree/bindings/vendor-prefixes.yaml | 2 + 2 files changed, 136 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpio/phytium,gpio.yaml
Documentation/devicetree/bindings/gpio/phytium,gpio.yaml new file +134 -0
@@ -0,0 +1,134 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/gpio/phytium,gpio.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Phytium GPIO controller + +description: | + Phytium GPIO controllers expose one GPIO/interrupt controller and up to + two configurable ports. Child nodes describe per-port configuration. + +maintainers: + - Chen Baozi <[email protected]> + +properties: + $nodename: + pattern: "^gpio@[0-9a-f]+$" + + compatible: + const: phytium,gpio + + reg: + maxItems: 1 + + gpio-controller: true + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + '#gpio-cells': + const: 2 + + interrupts: + description: | + The interrupts to the parent controller raised when GPIOs generate + the interrupts. If the controller provides one combined interrupt + for all GPIOs, specify a single interrupt. If the controller provides + one interrupt for each GPIO, provide a list of interrupts that + correspond to each of the GPIO pins. + minItems: 1 + maxItems: 32 + + interrupt-controller: true + + '#interrupt-cells': + const: 2 + +patternProperties: + "^gpio-port@[0-9a-f]+$": + type: object + properties: + compatible: + const: phytium,gpio-port + + reg: + maxItems: 1 + + gpio-controller: true + + '#gpio-cells': + const: 2 + + ngpios: + $ref: /schemas/types.yaml#/definitions/uint32 + description: The number of GPIO pins exported by the port. + default: 32 + minimum: 1 + maximum: 32 + + nr-gpios: + $ref: /schemas/types.yaml#/definitions/uint32 + description: The number of GPIO pins exported by the port. + deprecated: true + default: 32 + minimum: 1 + maximum: 32 + + required: + - compatible + - reg + - gpio-controller + - '#gpio-cells' + + additionalProperties: false + +additionalProperties: false + +required: + - compatible + - reg + - gpio-controller + - "#gpio-cells" + - interrupts + - interrupt-controller + - "#interrupt-cells" + - "#address-cells" + - "#size-cells" + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + + gpio: gpio@28004000 { + compatible = "phytium,gpio"; + reg = <0x28004000 0x1000>; + gpio-controller; + #gpio-cells = <2>; + #address-cells = <1>; + #size-cells = <0>; + interrupts = <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>; + interrupt-controller; + #interrupt-cells = <2>; + + porta: gpio-port@0 { + compatible = "phytium,gpio-port"; + reg = <0>; + gpio-controller; + #gpio-cells = <2>; + ngpios = <8>; + }; + + portb: gpio-port@1 { + compatible = "phytium,gpio-port"; + reg = <1>; + gpio-controller; + #gpio-cells = <2>; + ngpios = <8>; + }; + }; +...
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
@@ -1265,6 +1265,8 @@ patternProperties: description: PHICOMM Co., Ltd. "^phontech,.*": description: Phontech + "^phytium,.*": + description: Phytium Technology Co., Ltd. "^phytec,.*": description: PHYTEC Messtechnik GmbH "^picochip,.*":
Signature · 1 line
2.34.1
Re: [PATCH v1 1/3] dt-bindings: gpio: add Phytium GPIO controller
Quoted 2 lines · Zhu Ling
Add the devicetree binding schema for the Phytium platform GPIO controller.
What is Phytium platform?
Quoted 5 lines
Register the "phytium" vendor prefix used by the compatible string.
Use ngpios as the preferred child-node property and keep nr-gpios as deprecated for compatibility with existing firmware descriptions.
NAK, you cannot add new deprecated properties. "existing firmware" does not matter, because this is the first posting, thus the firmware starts existing from now.
Quoted 14 lines
Signed-off-by Zhu Ling <[email protected]>--- .../bindings/gpio/phytium,gpio.yaml | 134 ++++++++++++++++++ .../devicetree/bindings/vendor-prefixes.yaml | 2 + 2 files changed, 136 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpio/phytium,gpio.yamlDocumentation/devicetree/bindings/gpio/phytium,gpio.yaml new file +0
-0
Documentation/devicetree/bindings/gpio/phytium,gpio.yaml line 9
Quoted 9 lines
Documentation/devicetree/bindings/gpio/phytium,gpio.yaml new file +9
-0@@ -0,0 +1,134 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/gpio/phytium,gpio.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Phytium GPIO controller + +description: |
Do not need '|' unless you need to preserve formatting.
Documentation/devicetree/bindings/gpio/phytium,gpio.yaml line 18
Quoted 9 lines
Documentation/devicetree/bindings/gpio/phytium,gpio.yaml new file +9
-0+ Phytium GPIO controllers expose one GPIO/interrupt controller and up to + two configurable ports. Child nodes describe per-port configuration. + +maintainers: + - Chen Baozi <[email protected]> + +properties: + $nodename: + pattern: "^gpio@[0-9a-f]+$"
Drop
Documentation/devicetree/bindings/gpio/phytium,gpio.yaml line 21
Quoted 3 lines
Documentation/devicetree/bindings/gpio/phytium,gpio.yaml new file +3
-0+ + compatible: + const: phytium,gpio
This is way too generic. Phytium made or will ever make only one controller?
Quoted 4 lines
Documentation/devicetree/bindings/gpio/phytium,gpio.yaml new file +4
-0+ + reg: + maxItems: 1 +
Documentation/devicetree/bindings/gpio/phytium,gpio.yaml line 35
Quoted 10 lines
Documentation/devicetree/bindings/gpio/phytium,gpio.yaml new file +10
-0+ gpio-controller: true + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + '#gpio-cells': + const: 2
Why do you need cells here and in the children?
Documentation/devicetree/bindings/gpio/phytium,gpio.yaml line 45
Quoted 10 lines
Documentation/devicetree/bindings/gpio/phytium,gpio.yaml new file +10
-0+ + interrupts: + description: | + The interrupts to the parent controller raised when GPIOs generate + the interrupts. If the controller provides one combined interrupt + for all GPIOs, specify a single interrupt. If the controller provides + one interrupt for each GPIO, provide a list of interrupts that + correspond to each of the GPIO pins. + minItems: 1 + maxItems: 32
Why is this flexible? You have one fixed device, no?
Documentation/devicetree/bindings/gpio/phytium,gpio.yaml line 57
Quoted 12 lines
Documentation/devicetree/bindings/gpio/phytium,gpio.yaml new file +12
-0+ + interrupt-controller: true + + '#interrupt-cells': + const: 2 + +patternProperties: + "^gpio-port@[0-9a-f]+$": + type: object + properties: + compatible: + const: phytium,gpio-port
Drop compatible
Documentation/devicetree/bindings/gpio/phytium,gpio.yaml line 26
Quoted 5 lines
Documentation/devicetree/bindings/gpio/phytium,gpio.yaml new file +5
-0+ + reg: + maxItems: 1 + + gpio-controller: true
So what is the controller exactly?
Documentation/devicetree/bindings/gpio/phytium,gpio.yaml line 74
Quoted 12 lines
Documentation/devicetree/bindings/gpio/phytium,gpio.yaml new file +12
-0+ + '#gpio-cells': + const: 2 + + ngpios: + $ref: /schemas/types.yaml#/definitions/uint32 + description: The number of GPIO pins exported by the port. + default: 32 + minimum: 1 + maximum: 32 + + nr-gpios:
Drop, why do you create duplicated properties for everything?
Quoted 6 lines
Documentation/devicetree/bindings/gpio/phytium,gpio.yaml new file +6
-0+ $ref: /schemas/types.yaml#/definitions/uint32 + description: The number of GPIO pins exported by the port. + deprecated: true + default: 32 + minimum: 1 + maximum: 32
Documentation/devicetree/bindings/gpio/phytium,gpio.yaml line 90
Quoted 10 lines
Documentation/devicetree/bindings/gpio/phytium,gpio.yaml new file +10
-0+ + required: + - compatible + - reg + - gpio-controller + - '#gpio-cells' + + additionalProperties: false + +additionalProperties: false
This goes after required: block
Quoted 7 lines
Documentation/devicetree/bindings/gpio/phytium,gpio.yaml new file +7
-0+ +required: + - compatible + - reg + - gpio-controller + - "#gpio-cells" + - interrupts
Documentation/devicetree/bindings/gpio/phytium,gpio.yaml line 107
Quoted 10 lines
Documentation/devicetree/bindings/gpio/phytium,gpio.yaml new file +10
-0+ - interrupt-controller + - "#interrupt-cells" + - "#address-cells" + - "#size-cells" + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + + gpio: gpio@28004000 {
Drop unused label
Quoted 32 lines
Documentation/devicetree/bindings/gpio/phytium,gpio.yaml new file +27
-0+ compatible = "phytium,gpio"; + reg = <0x28004000 0x1000>; + gpio-controller; + #gpio-cells = <2>; + #address-cells = <1>; + #size-cells = <0>; + interrupts = <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>; + interrupt-controller; + #interrupt-cells = <2>; + + porta: gpio-port@0 { + compatible = "phytium,gpio-port"; + reg = <0>; + gpio-controller; + #gpio-cells = <2>; + ngpios = <8>; + }; + + portb: gpio-port@1 { + compatible = "phytium,gpio-port"; + reg = <1>; + gpio-controller; + #gpio-cells = <2>; + ngpios = <8>; + }; + }; +...Documentation/devicetree/bindings/vendor-prefixes.yaml +0
-0
Documentation/devicetree/bindings/vendor-prefixes.yaml patternProperties: · line 1268
Quoted 4 lines
Documentation/devicetree/bindings/vendor-prefixes.yaml +1
-0@@ -1265,6 +1265,8 @@ patternProperties: description: PHICOMM Co., Ltd. "^phontech,.*": description: Phontech + "^phytium,.*":
Keep proper sorting.
Quoted 7 lines
Documentation/devicetree/bindings/vendor-prefixes.yaml +1
-0+ description: Phytium Technology Co., Ltd. "^phytec,.*": description: PHYTEC Messtechnik GmbH "^picochip,.*":Signature · 1 line
2.34.1
Re: [PATCH v1 1/3] dt-bindings: gpio: add Phytium GPIO controller
In reply to Zhu LingQuoted 8 lines · Zhu Ling
Add the devicetree binding schema for the Phytium platform GPIO controller.
Register the "phytium" vendor prefix used by the compatible string.
Use ngpios as the preferred child-node property and keep nr-gpios as deprecated for compatibility with existing firmware descriptions.
You Cc-ed inactive address, not existing in the kernel for like 2 years, so clearly this was based on some old kernel.
No, you must work on mainline, not two years old stuff.
Please use scripts/get_maintainers.pl to get a list of necessary people and lists to CC (and consider --no-git-fallback argument, so you will not CC people just because they made one commit years ago). It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.
Tools like b4 or scripts/get_maintainer.pl provide you proper list of people, so fix your workflow. Tools might also fail if you work on some ancient tree (don't, instead use mainline) or work on fork of kernel (don't, instead use mainline). Just use b4 and everything should be fine, although remember about b4 prep --auto-to-cc if you added new patches to the patchset.
Best regards,
Krzysztof
PATCH 2/3 gpio: add support for Phytium platform GPIO controller
In reply to a message not in the archiveAdd support for the Phytium platform GPIO controller with:
- shared core helpers and irqchip implementation
- platform probe path for OF/ACPI
- Kconfig/Makefile integration
The driver supports GPIO direction and value configuration, plus interrupt delivery for platform devices.
--- drivers/gpio/Kconfig | 16 + drivers/gpio/Makefile | 2 + drivers/gpio/gpio-phytium-core.c | 444 +++++++++++++++++++++++++++ drivers/gpio/gpio-phytium-core.h | 90 ++++++ drivers/gpio/gpio-phytium-platform.c | 226 ++++++++++++++ 5 files changed, 778 insertions(+) create mode 100644 drivers/gpio/gpio-phytium-core.c create mode 100644 drivers/gpio/gpio-phytium-core.h create mode 100644 drivers/gpio/gpio-phytium-platform.c
drivers/gpio/Kconfig +16 -0
@@ -128,6 +128,10 @@ config GPIO_SWNODE_UNDEFINED config GPIO_MAX730X tristate +# This symbol is selected by Phytium platform frontend +config GPIO_PHYTIUM_CORE + tristate + config GPIO_IDIO_16 tristate select REGMAP_IRQ
@@ -561,6 +565,18 @@ config GPIO_OMAP help Say yes here to enable GPIO support for TI OMAP SoCs. +config GPIO_PHYTIUM_PLAT + tristate "Phytium GPIO platform support" + depends on (ARM64 || COMPILE_TEST) && (ACPI || OF_GPIO) + select GPIO_PHYTIUM_CORE + select GPIOLIB_IRQCHIP + help + Say yes here to support the platform GPIO controller + found in Phytium SoCs. + + This driver supports GPIO line configuration and + interrupt delivery. + config GPIO_PL061 tristate "PrimeCell PL061 GPIO support" depends on ARM_AMBA || COMPILE_TEST
drivers/gpio/Makefile +2 -0
@@ -144,6 +144,8 @@ obj-$(CONFIG_GPIO_PCF857X) += gpio-pcf857x.o obj-$(CONFIG_GPIO_PCH) += gpio-pch.o obj-$(CONFIG_GPIO_PCIE_IDIO_24) += gpio-pcie-idio-24.o obj-$(CONFIG_GPIO_PCI_IDIO_16) += gpio-pci-idio-16.o +obj-$(CONFIG_GPIO_PHYTIUM_CORE) += gpio-phytium-core.o +obj-$(CONFIG_GPIO_PHYTIUM_PLAT) += gpio-phytium-platform.o obj-$(CONFIG_GPIO_PISOSR) += gpio-pisosr.o obj-$(CONFIG_GPIO_PL061) += gpio-pl061.o obj-$(CONFIG_GPIO_PMIC_EIC_SPRD) += gpio-pmic-eic-sprd.o
drivers/gpio/gpio-phytium-core.c new file +444 -0
444 lines not on this page · raw message
drivers/gpio/gpio-phytium-core.h new file +90 -0
90 lines not on this page · raw message
drivers/gpio/gpio-phytium-platform.c new file +226 -0
226 lines not on this page · raw message
Signature · 1 line
2.34.1
Quoted 4 lines · Zhu Ling
Add support for the Phytium platform GPIO controller with:
- shared core helpers and irqchip implementation
- platform probe path for OF/ACPI
- Kconfig/Makefile integration
Why you can't use one of the gpio-regmap, gpio-mmio?
Quoted 2 lines
The driver supports GPIO direction and value configuration, plus interrupt delivery for platform devices.
...
Quoted 2 lines
+/*
+ * Copyright (c) 2019-2023, Phytium Technology Co., Ltd.
My calendar shows 2026...
Quoted 1 line
+ */
...
drivers/gpio/gpio-phytium-core.c line 12
Quoted 7 lines
drivers/gpio/gpio-phytium-core.c new file +7
-0+#include <linux/err.h> +#include <linux/io.h> +#include <linux/irq.h> +#include <linux/module.h> +#include <linux/bitops.h> +#include <linux/seq_file.h> +#include <linux/interrupt.h>
Follow IWYU principle.
...
I'm not going to review the rest as gpio-remap (or gpio-mmio) should make this driver much better and smaller.
Take your time to study existing cases.
...
Quoted 1 line
+EXPORT_SYMBOL_GPL(phytium_gpio_irq_disable);
No way. And if it's really needed, must be namespaced.
Btw, why the three files and not a standalone single one?
...
Quoted 1 line
+ * Derived from
drivers/gpio/gpio-pl061.c
Why? Does it uses the same or similar register layout?
drivers/gpio/gpio-phytium-platform.c line 16
Quoted 10 lines
+ * Copyright (C) 2008, 2009 Provigent Ltd.
+ */drivers/gpio/gpio-phytium-platform.c new file +7
-0+ +#include <linux/acpi.h> +#include <linux/err.h> +#include <linux/interrupt.h> +#include <linux/io.h> +#include <linux/irq.h> +#include <linux/kernel.h>
No way this header should be anyhow needed in this driver.
Quoted 10 lines
drivers/gpio/gpio-phytium-platform.c new file +6
-0+#include <linux/module.h> +#include <linux/of.h> +#include <linux/platform_device.h> +#include <linux/property.h> + +#include "gpio-phytium-core.h"
...
drivers/gpio/gpio-phytium-platform.c line 25
Quoted 2 lines
drivers/gpio/gpio-phytium-platform.c new file +2
-0+static const struct of_device_id phytium_gpio_of_match[] = { + { .compatible ="phytium,gpio" , },
No inner comma.
drivers/gpio/gpio-phytium-platform.c line 34
Quoted 9 lines
drivers/gpio/gpio-phytium-platform.c new file +9
-0+ { } +}; +MODULE_DEVICE_TABLE (of, phytium_gpio_of_match); + +static const struct acpi_device_id phytium_gpio_acpi_match[] = { + {"PHYT0001" ,0 }, + { } +}; +MODULE_DEVICE_TABLE (acpi, phytium_gpio_acpi_match);
These tables should be moved closer to their user.
...
drivers/gpio/gpio-phytium-platform.c line 57
Quoted 7 lines
drivers/gpio/gpio-phytium-platform.c new file +6
-0+struct device *dev = &pdev->dev; +struct resource *res; +struct phytium_gpio *gpio; +struct gpio_irq_chip *girq; +struct fwnode_handle *fwnode; +int i;
Why is 'i' signed?
Quoted 1 line
drivers/gpio/gpio-phytium-platform.c new file +1
-0+int err, irq_count;
...
drivers/gpio/gpio-phytium-platform.c line 67
Quoted 4 lines
drivers/gpio/gpio-phytium-platform.c new file +4
-0+ res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); + gpio->regs =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (gpio->regs)) +return PTR_ERR (gpio->regs);
There is a combined call devm_platform_...().
drivers/gpio/gpio-phytium-platform.c line 70
Quoted 2 lines
drivers/gpio/gpio-phytium-platform.c new file +2
-0+if (!device_get_child_node_count (dev)) +return -ENODEV ;
Why?!
...
drivers/gpio/gpio-phytium-platform.c line 72
Quoted 1 line
drivers/gpio/gpio-phytium-platform.c new file +1
-0+device_for_each_child_node (dev, fwnode) {
Use _scoped() variant
drivers/gpio/gpio-phytium-platform.c line 77
Quoted 5 lines
drivers/gpio/gpio-phytium-platform.c new file +5
-0+int idx; + +if (fwnode_property_read_u32 (fwnode,"reg" , &idx) || + idx >=MAX_NPORTS ) { +dev_err (dev,"missing/invalid port index\n" );
return dev_err_probe(...);
drivers/gpio/gpio-phytium-platform.c line 88
Quoted 11 lines
drivers/gpio/gpio-phytium-platform.c new file +11
-0+fwnode_handle_put (fwnode); +return -EINVAL ; + } + +if ((fwnode_property_read_u32 (fwnode,"ngpios" , + &gpio->ngpio[idx])) && + (fwnode_property_read_u32 (fwnode,"nr-gpios" , + &gpio->ngpio[idx]))) { +dev_info (dev, +"failed to get number of gpios for Port%c\n" , + idx ?'B' :'A' );
It rings a bell. Do you really have to create a brand new driver? Please check existing ones and clarify why the brand new driver is required.
Quoted 3 lines
drivers/gpio/gpio-phytium-platform.c new file +3
-0+ gpio->ngpio[idx] =NGPIO_DEFAULT ; + } + }
...
drivers/gpio/gpio-phytium-platform.c line 147
Quoted 2 lines
drivers/gpio/gpio-phytium-platform.c new file +2
-0+dev_info (dev,"Phytium GPIO controller @%pa registered\n" , + &res->start);
The successfully probed device is kept silent in the logs.
...
Quoted 1 line
+#ifdef
CONFIG_PM_SLEEP
No way, please, use modern PM macros from pm.h.
drivers/gpio/gpio-phytium-platform.c line 156
Quoted 4 lines
drivers/gpio/gpio-phytium-platform.c new file +4
-0+static int phytium_gpio_suspend (struct device *dev) +{ +struct platform_device *pdev =to_platform_device (dev); +struct phytium_gpio *gpio =platform_get_drvdata (pdev);
dev_get_drvdata()
Quoted 17 lines
drivers/gpio/gpio-phytium-platform.c new file +17
-0+unsigned long flags; + +raw_spin_lock_irqsave (&gpio->lock, flags); + + gpio->ctx.swporta_dr =readl (gpio->regs +GPIO_SWPORTA_DR ); + gpio->ctx.swporta_ddr =readl (gpio->regs +GPIO_SWPORTA_DDR ); + gpio->ctx.swportb_dr =readl (gpio->regs +GPIO_SWPORTB_DR ); + gpio->ctx.swportb_ddr =readl (gpio->regs +GPIO_SWPORTB_DDR ); + + gpio->ctx.inten =readl (gpio->regs +GPIO_INTEN ); + gpio->is_resuming =1 ; + gpio->ctx.intmask =readl (gpio->regs +GPIO_INTMASK ); + gpio->ctx.inttype_level =readl (gpio->regs +GPIO_INTTYPE_LEVEL ); + gpio->ctx.int_polarity =readl (gpio->regs +GPIO_INT_POLARITY ); + gpio->ctx.debounce =readl (gpio->regs +GPIO_DEBOUNCE ); + +writel (~gpio->wake_en, gpio->regs +GPIO_INTMASK );
drivers/gpio/gpio-phytium-platform.c line 183
Quoted 10 lines
drivers/gpio/gpio-phytium-platform.c new file +10
-0+writel (gpio->wake_en, gpio->regs +GPIO_INTEN ); +raw_spin_unlock_irqrestore (&gpio->lock, flags); + +return 0 ; +} + +static int phytium_gpio_resume (struct device *dev) +{ +struct platform_device *pdev =to_platform_device (dev); +struct phytium_gpio *gpio =platform_get_drvdata (pdev);
Ditto.
drivers/gpio/gpio-phytium-core.c line 87
Quoted 3 lines
drivers/gpio/gpio-phytium-core.c new file +3
-0+unsigned long flags; + +raw_spin_lock_irqsave (&gpio->lock, flags);
Use guard()().
Quoted 20 lines
drivers/gpio/gpio-phytium-platform.c new file +20
-0+writel (gpio->ctx.swporta_dr, gpio->regs +GPIO_SWPORTA_DR ); +writel (gpio->ctx.swporta_ddr, gpio->regs +GPIO_SWPORTA_DDR ); +writel (gpio->ctx.swportb_dr, gpio->regs +GPIO_SWPORTB_DR ); +writel (gpio->ctx.swportb_ddr, gpio->regs +GPIO_SWPORTB_DDR ); + +writel (gpio->ctx.intmask, gpio->regs +GPIO_INTMASK ); +writel (gpio->ctx.inttype_level, gpio->regs +GPIO_INTTYPE_LEVEL ); +writel (gpio->ctx.int_polarity, gpio->regs +GPIO_INT_POLARITY ); +writel (gpio->ctx.debounce, gpio->regs +GPIO_DEBOUNCE ); + +writel (GPIO_CLEAR_IRQ , gpio->regs +GPIO_PORTA_EOI ); + +writel (gpio->ctx.inten, gpio->regs +GPIO_INTEN ); + gpio->is_resuming =0 ; + +raw_spin_unlock_irqrestore (&gpio->lock, flags); + + return 0; +} +#endif
...
drivers/gpio/gpio-phytium-platform.c line 210
Quoted 2 lines
drivers/gpio/gpio-phytium-platform.c new file +2
-0+static SIMPLE_DEV_PM_OPS(phytium_gpio_pm_ops, phytium_gpio_suspend, + phytium_gpio_resume);
Use new PM macros.
...
drivers/gpio/gpio-phytium-platform.c line 217
Quoted 7 lines
drivers/gpio/gpio-phytium-platform.c new file +6
-0+static struct platform_driver phytium_gpio_driver = { + .driver = { + .name ="gpio-phytium-platform" , + .pm = &phytium_gpio_pm_ops, + .of_match_table =of_match_ptr (phytium_gpio_of_match), + .acpi_match_table =ACPI_PTR (phytium_gpio_acpi_match),
No way of_match_ptr() and/or ACPI_PTR() should appear in a new code.
drivers/gpio/gpio-phytium-platform.c line 221
Quoted 5 lines
drivers/gpio/gpio-phytium-platform.c new file +4
-0+ }, + .probe = phytium_gpio_probe, +}; +
Redundant blank line.
Quoted 1 line
+module_platform_driver(phytium_gpio_driver);
Signature · 2 lines
With Best Regards, Andy Shevchenko
Linus Walleij
maintainerHi Zhu,
thanks for your patch!
some quick remarks below:
Quoted 5 lines · Zhu Ling
Add support for the Phytium platform GPIO controller with:
- shared core helpers and irqchip implementation
- platform probe path for OF/ACPI
- Kconfig/Makefile integration
Quoted 8 lines
The driver supports GPIO direction and value configuration, plus interrupt delivery for platform devices.
Signed-off-by Zhu Ling <[email protected]>drivers/gpio/gpio-phytium-core.c | 444 +++++++++++++++++++++++++++ drivers/gpio/gpio-phytium-core.h | 90 ++++++ drivers/gpio/gpio-phytium-platform.c | 226 ++++++++++++++
Why this split? Put it all into one file.
Rewrite the driver to use the GPIO_GENERIC (MMIO) library, select GPIO_GENERIC, look at other generic MMIO drivers such as gpio-ftgpio010.c for inspiration.
Yours,
Linus Walleij
PATCH 3/3 MAINTAINERS: add entry for Phytium platform GPIO driver
In reply to a message not in the archiveAdd maintainer contacts and file patterns for the Phytium platform GPIO binding and driver files.
--- MAINTAINERS | 10 ++++++++++ 1 file changed, 10 insertions(+)
MAINTAINERS +10 -0
@@ -10963,6 +10963,16 @@ K: (devm_)?gpio_(request|free|direction|get|set) K: GPIOD_FLAGS_BIT_NONEXCLUSIVE K: devm_gpiod_unhinge +PHYTIUM GPIO DRIVERS +M: Zhu Ling <[email protected]> +M: Chen Baozi <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/gpio/phytium,gpio.yaml +F: drivers/gpio/gpio-phytium-core.c +F: drivers/gpio/gpio-phytium-core.h +F: drivers/gpio/gpio-phytium-platform.c + GPIO UAPI M: Bartosz Golaszewski <[email protected]> R: Kent Gibson <[email protected]>
Signature · 1 line
2.34.1
Re: [PATCH v1 3/3] MAINTAINERS: add entry for Phytium platform GPIO driver
Quoted 2 lines · Zhu Ling
Add maintainer contacts and file patterns for the Phytium platform GPIO binding and driver files.
Doesn't look like this placed correctly. There is a script to sort the MAINTAINERS database, please use it to find a better location for a new record. scripts/parse-maintainers.pl
Signature · 2 lines
With Best Regards, Andy Shevchenko