| 1 |
# SPDX-License-Identifier: BSD-2-Clause |
| 2 |
# Copyright 2018 Linaro Ltd. |
| 3 |
$id: http://devicetree.org/schemas/gpio/gpio.yaml# |
| 4 |
$schema: http://devicetree.org/meta-schemas/base.yaml# |
| 5 |
|
| 6 |
title: GPIO Controller Common Properties |
| 7 |
|
| 8 |
description: | |
| 9 |
Every GPIO controller node must contain both an empty "gpio-controller" |
| 10 |
property, and a #gpio-cells integer property, which indicates the number of |
| 11 |
cells in a gpio-specifier. |
| 12 |
|
| 13 |
Some system-on-chips (SoCs) use the concept of GPIO banks. A GPIO bank is an |
| 14 |
instance of a hardware IP core on a silicon die, usually exposed to the |
| 15 |
programmer as a coherent range of I/O addresses. Usually each such bank is |
| 16 |
exposed in the device tree as an individual gpio-controller node, reflecting |
| 17 |
the fact that the hardware was synthesized by reusing the same IP block a few |
| 18 |
times over. |
| 19 |
|
| 20 |
maintainers: |
| 21 |
- Rob Herring <[email protected]> |
| 22 |
|
| 23 |
# always select the core schema |
| 24 |
select: true |
| 25 |
|
| 26 |
properties: |
| 27 |
"#gpio-cells": true |
| 28 |
gpio-controller: |
| 29 |
$ref: /schemas/types.yaml#/definitions/flag |
| 30 |
gpio-line-names: |
| 31 |
$ref: /schemas/types.yaml#/definitions/non-unique-string-array |
| 32 |
description: > |
| 33 |
An array of strings defining the names of the GPIO lines going out of the |
| 34 |
GPIO controller. This name should be the most meaningful producer name for |
| 35 |
the system, such as a rail name indicating the usage. Package names such |
| 36 |
as pin name are discouraged: such lines have opaque names (since they are |
| 37 |
by definition generic purpose) and such names are usually not very |
| 38 |
helpful. For example "MMC-CD", "Red LED Vdd" and "ethernet reset" are |
| 39 |
reasonable line names as they describe what the line is used for. "GPIO0" |
| 40 |
is not a good name to give to a GPIO line. Placeholders are discouraged: |
| 41 |
rather use the "" (blank string) if the use of the GPIO line is undefined |
| 42 |
in your design. The names are assigned starting from line offset 0 from |
| 43 |
left to right from the passed array. An incomplete array (where the number |
| 44 |
of passed named are less than ngpios) will still be used up until the last |
| 45 |
provided valid line index. |
| 46 |
|
| 47 |
ngpios: |
| 48 |
$ref: /schemas/types.yaml#/definitions/uint32 |
| 49 |
description: > |
| 50 |
Indicates the number of in-use slots of available slots for GPIOs. The |
| 51 |
typical example is something like this: the hardware register is 32 bits |
| 52 |
wide, but only 18 of the bits have a physical counterpart. The driver is |
| 53 |
generally written so that all 32 bits can be used, but the IP block is |
| 54 |
reused in a lot of designs, some using all 32 bits, some using 18 and some |
| 55 |
using 12. In this case, setting "ngpios = <18>;" informs the driver that |
| 56 |
only the first 18 GPIOs, at local offset 0 .. 17, are in use. If these |
| 57 |
GPIOs do not happen to be the first N GPIOs at offset 0...N-1, an |
| 58 |
additional set of tuples is needed to specify which GPIOs are unusable, |
| 59 |
with the gpio-reserved-ranges binding. |
| 60 |
|
| 61 |
gpio-reserved-ranges: |
| 62 |
$ref: /schemas/types.yaml#/definitions/uint32-matrix |
| 63 |
items: |
| 64 |
minItems: 2 |
| 65 |
maxItems: 2 |
| 66 |
description: |
| 67 |
Indicates the start and size of the GPIOs that can't be used. |
| 68 |
|
| 69 |
gpio-ranges: |
| 70 |
$ref: /schemas/types.yaml#/definitions/phandle-array |
| 71 |
items: |
| 72 |
items: |
| 73 |
- description: pin controller phandle |
| 74 |
- description: GPIO controller offset |
| 75 |
- description: pin controller offset |
| 76 |
- description: number of pins |
| 77 |
|
| 78 |
dependencies: |
| 79 |
gpio-controller: ['#gpio-cells'] |
| 80 |
gpio-line-names: ['#gpio-cells', gpio-controller] |
| 81 |
ngpios: ['#gpio-cells', gpio-controller] |
| 82 |
gpio-reserved-ranges: ['#gpio-cells', gpio-controller] |
| 83 |
gpio-ranges: ['#gpio-cells', gpio-controller] |
| 84 |
|
| 85 |
additionalProperties: true |