Skip to content

Commit

Permalink
Merge pull request #155 from hhhui-L/gpio
Browse files Browse the repository at this point in the history
gpio: Add Phytium GPIO driver
  • Loading branch information
opsiff authored Jun 19, 2024
2 parents 51edfdd + 2fa192d commit 2822edc
Show file tree
Hide file tree
Showing 8 changed files with 1,012 additions and 0 deletions.
114 changes: 114 additions & 0 deletions Documentation/devicetree/bindings/gpio/phytium,gpio.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# 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 have one or two configurable ports, each of which
are intended to be represented as child nodes with the generic GPIO-controller
properties as desribed in this bindings file.
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|controller)@[0-9a-f]+$":
type: object
properties:
compatible:
const: phytium,gpio-port

reg:
maxItems: 1

nr-gpios:
$ref: /schemas/types.yaml#/definitions/uint32
description: The number of GPIO pins exported by the port.
default: 32
minimum: 1
maximum: 32

required:
- compatible
- reg
- gpio-controller
- '#gpio-cells'

dependencies:
interrupt-controller: [ interrupts ]

additionalProperties: false

additionalProperties: false

required:
- compatible
- reg
- "#address-cells"
- "#size-cells"

examples:
- |
gpio: gpio@28004000 {
compatible = "phytium,gpio";
reg = <0x0 0x28004000 0x0 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>;
nr-gpios = <8>;
};
portb: gpio-port@1 {
compatible = "phytium,gpio-port";
reg = <1>;
nr-gpios = <8>;
};
};
...
2 changes: 2 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -17424,7 +17424,9 @@ ARM/PHYTIUM SOC SUPPORT
M: Wang Yinfeng <[email protected]>
S: Maintained
W: https://gerrit.b.cpu.ac/c/linux
F: Documentation/devicetree/bindings/gpio/phytium,gpio.yaml
F: arch/arm64/boot/dts/phytium/*
F: drivers/gpio/gpio-phytium*

QAT DRIVER
M: Giovanni Cabiddu <[email protected]>
Expand Down
29 changes: 29 additions & 0 deletions drivers/gpio/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ config GPIO_REGMAP

# put drivers in the right section, in alphabetical order

# This symbol is selected by both MMIO and PCI expanders
config GPIO_PHYTIUM_CORE
tristate

# This symbol is selected by both I2C and SPI expanders
config GPIO_MAX730X
tristate
Expand Down Expand Up @@ -495,6 +499,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"
default y if ARCH_PHYTIUM
depends on ARM64
select GPIO_PHYTIUM_CORE
select IRQ_DOMAIN
select GENERIC_IRQ_CHIP
select GPIOLIB_IRQCHIP
help
Say yes here to support the on-chip GPIO controller for the
Phytium SoC family.

config GPIO_PL061
tristate "PrimeCell PL061 GPIO support"
depends on ARM_AMBA
Expand Down Expand Up @@ -1680,6 +1696,19 @@ config GPIO_PCIE_IDIO_24
Input filter control is not supported by this driver, and the input
filters are deactivated by this driver.

config GPIO_PHYTIUM_PCI
tristate "Phytium GPIO PCI support"
select GPIO_PHYTIUM_CORE
select IRQ_DOMAIN
select GENERIC_IRQ_CHIP
select GPIOLIB_IRQCHIP
help
Say Y here to support Phytium PCI GPIO controller on Px210 chipset.
An interrupt is generated when any of the inputs change state
(low to high or high to low).

This driver can be used for Phytium Px210.

config GPIO_RDC321X
tristate "RDC R-321x GPIO support"
select MFD_CORE
Expand Down
3 changes: 3 additions & 0 deletions drivers/gpio/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ 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_PCI) += gpio-phytium-pci.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
Expand Down
Loading

0 comments on commit 2822edc

Please sign in to comment.