162306a36Sopenharmony_ci* Open PIC Binding
262306a36Sopenharmony_ci
362306a36Sopenharmony_ciThis binding specifies what properties must be available in the device tree
462306a36Sopenharmony_cirepresentation of an Open PIC compliant interrupt controller.  This binding is
562306a36Sopenharmony_cibased on the binding defined for Open PIC in [1] and is a superset of that
662306a36Sopenharmony_cibinding.
762306a36Sopenharmony_ci
862306a36Sopenharmony_ciRequired properties:
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci  NOTE: Many of these descriptions were paraphrased here from [1] to aid
1162306a36Sopenharmony_ci        readability.
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci    - compatible: Specifies the compatibility list for the PIC.  The type
1462306a36Sopenharmony_ci      shall be <string> and the value shall include "open-pic".
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci    - reg: Specifies the base physical address(s) and size(s) of this
1762306a36Sopenharmony_ci      PIC's addressable register space.  The type shall be <prop-encoded-array>.
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci    - interrupt-controller: The presence of this property identifies the node
2062306a36Sopenharmony_ci      as an Open PIC.  No property value shall be defined.
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci    - #interrupt-cells: Specifies the number of cells needed to encode an
2362306a36Sopenharmony_ci      interrupt source.  The type shall be a <u32> and the value shall be 2.
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci    - #address-cells: Specifies the number of cells needed to encode an
2662306a36Sopenharmony_ci      address.  The type shall be <u32> and the value shall be 0.  As such,
2762306a36Sopenharmony_ci      'interrupt-map' nodes do not have to specify a parent unit address.
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ciOptional properties:
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci    - pic-no-reset: The presence of this property indicates that the PIC
3262306a36Sopenharmony_ci      shall not be reset during runtime initialization.  No property value shall
3362306a36Sopenharmony_ci      be defined.  The presence of this property also mandates that any
3462306a36Sopenharmony_ci      initialization related to interrupt sources shall be limited to sources
3562306a36Sopenharmony_ci      explicitly referenced in the device tree.
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci* Interrupt Specifier Definition
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ci  Interrupt specifiers consists of 2 cells encoded as
4062306a36Sopenharmony_ci  follows:
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci    - <1st-cell>: The interrupt-number that identifies the interrupt source.
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci    - <2nd-cell>: The level-sense information, encoded as follows:
4562306a36Sopenharmony_ci                    0 = low-to-high edge triggered
4662306a36Sopenharmony_ci                    1 = active low level-sensitive
4762306a36Sopenharmony_ci                    2 = active high level-sensitive
4862306a36Sopenharmony_ci                    3 = high-to-low edge triggered
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci* Examples
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ciExample 1:
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci	/*
5562306a36Sopenharmony_ci	 * An Open PIC interrupt controller
5662306a36Sopenharmony_ci	 */
5762306a36Sopenharmony_ci	mpic: pic@40000 {
5862306a36Sopenharmony_ci		// This is an interrupt controller node.
5962306a36Sopenharmony_ci		interrupt-controller;
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci		// No address cells so that 'interrupt-map' nodes which reference
6262306a36Sopenharmony_ci		// this Open PIC node do not need a parent address specifier.
6362306a36Sopenharmony_ci		#address-cells = <0>;
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci		// Two cells to encode interrupt sources.
6662306a36Sopenharmony_ci		#interrupt-cells = <2>;
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ci		// Offset address of 0x40000 and size of 0x40000.
6962306a36Sopenharmony_ci		reg = <0x40000 0x40000>;
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ci		// Compatible with Open PIC.
7262306a36Sopenharmony_ci		compatible = "open-pic";
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ci		// The PIC shall not be reset.
7562306a36Sopenharmony_ci		pic-no-reset;
7662306a36Sopenharmony_ci	};
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ciExample 2:
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_ci	/*
8162306a36Sopenharmony_ci	 * An interrupt generating device that is wired to an Open PIC.
8262306a36Sopenharmony_ci	 */
8362306a36Sopenharmony_ci	serial0: serial@4500 {
8462306a36Sopenharmony_ci		// Interrupt source '42' that is active high level-sensitive.
8562306a36Sopenharmony_ci		// Note that there are only two cells as specified in the interrupt
8662306a36Sopenharmony_ci		// parent's '#interrupt-cells' property.
8762306a36Sopenharmony_ci		interrupts = <42 2>;
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci		// The interrupt controller that this device is wired to.
9062306a36Sopenharmony_ci		interrupt-parent = <&mpic>;
9162306a36Sopenharmony_ci	};
9262306a36Sopenharmony_ci
9362306a36Sopenharmony_ci* References
9462306a36Sopenharmony_ci
9562306a36Sopenharmony_ci[1] Devicetree Specification
9662306a36Sopenharmony_ci    (https://www.devicetree.org/specifications/)
9762306a36Sopenharmony_ci
98