xref: /freebsd/sys/contrib/device-tree/Bindings/pinctrl/pinctrl-mt65xx.txt (revision 6be3386466ab79a84b48429ae66244f21526d3df)
1c66ec88fSEmmanuel Vadot* Mediatek MT65XX Pin Controller
2c66ec88fSEmmanuel Vadot
3c66ec88fSEmmanuel VadotThe Mediatek's Pin controller is used to control SoC pins.
4c66ec88fSEmmanuel Vadot
5c66ec88fSEmmanuel VadotRequired properties:
6c66ec88fSEmmanuel Vadot- compatible: value should be one of the following.
7c66ec88fSEmmanuel Vadot	"mediatek,mt2701-pinctrl", compatible with mt2701 pinctrl.
8c66ec88fSEmmanuel Vadot	"mediatek,mt2712-pinctrl", compatible with mt2712 pinctrl.
9c66ec88fSEmmanuel Vadot	"mediatek,mt6397-pinctrl", compatible with mt6397 pinctrl.
10c66ec88fSEmmanuel Vadot	"mediatek,mt7623-pinctrl", compatible with mt7623 pinctrl.
11c66ec88fSEmmanuel Vadot	"mediatek,mt8127-pinctrl", compatible with mt8127 pinctrl.
12c66ec88fSEmmanuel Vadot	"mediatek,mt8135-pinctrl", compatible with mt8135 pinctrl.
13*6be33864SEmmanuel Vadot	"mediatek,mt8167-pinctrl", compatible with mt8167 pinctrl.
14c66ec88fSEmmanuel Vadot	"mediatek,mt8173-pinctrl", compatible with mt8173 pinctrl.
15c66ec88fSEmmanuel Vadot	"mediatek,mt8516-pinctrl", compatible with mt8516 pinctrl.
16c66ec88fSEmmanuel Vadot- pins-are-numbered: Specify the subnodes are using numbered pinmux to
17c66ec88fSEmmanuel Vadot  specify pins.
18c66ec88fSEmmanuel Vadot- gpio-controller : Marks the device node as a gpio controller.
19c66ec88fSEmmanuel Vadot- #gpio-cells: number of cells in GPIO specifier. Since the generic GPIO
20c66ec88fSEmmanuel Vadot  binding is used, the amount of cells must be specified as 2. See the below
21c66ec88fSEmmanuel Vadot  mentioned gpio binding representation for description of particular cells.
22c66ec88fSEmmanuel Vadot
23c66ec88fSEmmanuel Vadot	Eg: <&pio 6 0>
24c66ec88fSEmmanuel Vadot	<[phandle of the gpio controller node]
25c66ec88fSEmmanuel Vadot	[line number within the gpio controller]
26c66ec88fSEmmanuel Vadot	[flags]>
27c66ec88fSEmmanuel Vadot
28c66ec88fSEmmanuel Vadot	Values for gpio specifier:
29c66ec88fSEmmanuel Vadot	- Line number: is a value between 0 to 202.
30c66ec88fSEmmanuel Vadot	- Flags:  bit field of flags, as defined in <dt-bindings/gpio/gpio.h>.
31c66ec88fSEmmanuel Vadot            Only the following flags are supported:
32c66ec88fSEmmanuel Vadot            0 - GPIO_ACTIVE_HIGH
33c66ec88fSEmmanuel Vadot            1 - GPIO_ACTIVE_LOW
34c66ec88fSEmmanuel Vadot
35c66ec88fSEmmanuel VadotOptional properties:
36c66ec88fSEmmanuel Vadot- mediatek,pctl-regmap: Should be a phandle of the syscfg node.
37c66ec88fSEmmanuel Vadot- reg: physicall address base for EINT registers
38c66ec88fSEmmanuel Vadot- interrupt-controller: Marks the device node as an interrupt controller
39c66ec88fSEmmanuel Vadot- #interrupt-cells: Should be two.
40c66ec88fSEmmanuel Vadot- interrupts : The interrupt outputs from the controller.
41c66ec88fSEmmanuel Vadot
42c66ec88fSEmmanuel VadotPlease refer to pinctrl-bindings.txt in this directory for details of the
43c66ec88fSEmmanuel Vadotcommon pinctrl bindings used by client devices.
44c66ec88fSEmmanuel Vadot
45c66ec88fSEmmanuel VadotSubnode format
46c66ec88fSEmmanuel VadotA pinctrl node should contain at least one subnodes representing the
47c66ec88fSEmmanuel Vadotpinctrl groups available on the machine. Each subnode will list the
48c66ec88fSEmmanuel Vadotpins it needs, and how they should be configured, with regard to muxer
49c66ec88fSEmmanuel Vadotconfiguration, pullups, drive strength, input enable/disable and input schmitt.
50c66ec88fSEmmanuel Vadot
51c66ec88fSEmmanuel Vadot    node {
52c66ec88fSEmmanuel Vadot	pinmux = <PIN_NUMBER_PINMUX>;
53c66ec88fSEmmanuel Vadot	GENERIC_PINCONFIG;
54c66ec88fSEmmanuel Vadot    };
55c66ec88fSEmmanuel Vadot
56c66ec88fSEmmanuel VadotRequired properties:
57c66ec88fSEmmanuel Vadot- pinmux: integer array, represents gpio pin number and mux setting.
58c66ec88fSEmmanuel Vadot    Supported pin number and mux varies for different SoCs, and are defined
59c66ec88fSEmmanuel Vadot    as macros in boot/dts/<soc>-pinfunc.h directly.
60c66ec88fSEmmanuel Vadot
61c66ec88fSEmmanuel VadotOptional properties:
62c66ec88fSEmmanuel Vadot- GENERIC_PINCONFIG: is the generic pinconfig options to use, bias-disable,
63c66ec88fSEmmanuel Vadot    bias-pull-down, bias-pull-up, input-enable, input-disable, output-low, output-high,
64c66ec88fSEmmanuel Vadot    input-schmitt-enable, input-schmitt-disable and drive-strength are valid.
65c66ec88fSEmmanuel Vadot
66c66ec88fSEmmanuel Vadot    Some special pins have extra pull up strength, there are R0 and R1 pull-up
67c66ec88fSEmmanuel Vadot    resistors available, but for user, it's only need to set R1R0 as 00, 01, 10 or 11.
68c66ec88fSEmmanuel Vadot    So when config bias-pull-up, it support arguments for those special pins.
69c66ec88fSEmmanuel Vadot    Some macros have been defined for this usage, such as MTK_PUPD_SET_R1R0_00.
70c66ec88fSEmmanuel Vadot    See dt-bindings/pinctrl/mt65xx.h.
71c66ec88fSEmmanuel Vadot
72c66ec88fSEmmanuel Vadot    When config drive-strength, it can support some arguments, such as
73c66ec88fSEmmanuel Vadot    MTK_DRIVE_4mA, MTK_DRIVE_6mA, etc. See dt-bindings/pinctrl/mt65xx.h.
74c66ec88fSEmmanuel Vadot
75c66ec88fSEmmanuel VadotExamples:
76c66ec88fSEmmanuel Vadot
77c66ec88fSEmmanuel Vadot#include "mt8135-pinfunc.h"
78c66ec88fSEmmanuel Vadot
79c66ec88fSEmmanuel Vadot...
80c66ec88fSEmmanuel Vadot{
81c66ec88fSEmmanuel Vadot	syscfg_pctl_a: syscfg-pctl-a@10005000 {
82c66ec88fSEmmanuel Vadot		compatible = "mediatek,mt8135-pctl-a-syscfg", "syscon";
83c66ec88fSEmmanuel Vadot		reg = <0 0x10005000 0 0x1000>;
84c66ec88fSEmmanuel Vadot	};
85c66ec88fSEmmanuel Vadot
86c66ec88fSEmmanuel Vadot	syscfg_pctl_b: syscfg-pctl-b@1020c020 {
87c66ec88fSEmmanuel Vadot		compatible = "mediatek,mt8135-pctl-b-syscfg", "syscon";
88c66ec88fSEmmanuel Vadot		reg = <0 0x1020C020 0 0x1000>;
89c66ec88fSEmmanuel Vadot	};
90c66ec88fSEmmanuel Vadot
91c66ec88fSEmmanuel Vadot	pinctrl@1c20800 {
92c66ec88fSEmmanuel Vadot		compatible = "mediatek,mt8135-pinctrl";
93c66ec88fSEmmanuel Vadot		reg = <0 0x1000B000 0 0x1000>;
94c66ec88fSEmmanuel Vadot		mediatek,pctl-regmap = <&syscfg_pctl_a &syscfg_pctl_b>;
95c66ec88fSEmmanuel Vadot		pins-are-numbered;
96c66ec88fSEmmanuel Vadot		gpio-controller;
97c66ec88fSEmmanuel Vadot		#gpio-cells = <2>;
98c66ec88fSEmmanuel Vadot		interrupt-controller;
99c66ec88fSEmmanuel Vadot		#interrupt-cells = <2>;
100c66ec88fSEmmanuel Vadot		interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>,
101c66ec88fSEmmanuel Vadot				<GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>,
102c66ec88fSEmmanuel Vadot				<GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>;
103c66ec88fSEmmanuel Vadot
104c66ec88fSEmmanuel Vadot		i2c0_pins_a: i2c0@0 {
105c66ec88fSEmmanuel Vadot			pins1 {
106c66ec88fSEmmanuel Vadot				pinmux = <MT8135_PIN_100_SDA0__FUNC_SDA0>,
107c66ec88fSEmmanuel Vadot					 <MT8135_PIN_101_SCL0__FUNC_SCL0>;
108c66ec88fSEmmanuel Vadot				bias-disable;
109c66ec88fSEmmanuel Vadot			};
110c66ec88fSEmmanuel Vadot		};
111c66ec88fSEmmanuel Vadot
112c66ec88fSEmmanuel Vadot		i2c1_pins_a: i2c1@0 {
113c66ec88fSEmmanuel Vadot			pins {
114c66ec88fSEmmanuel Vadot				pinmux = <MT8135_PIN_195_SDA1__FUNC_SDA1>,
115c66ec88fSEmmanuel Vadot					 <MT8135_PIN_196_SCL1__FUNC_SCL1>;
116c66ec88fSEmmanuel Vadot				bias-pull-up = <55>;
117c66ec88fSEmmanuel Vadot			};
118c66ec88fSEmmanuel Vadot		};
119c66ec88fSEmmanuel Vadot
120c66ec88fSEmmanuel Vadot		i2c2_pins_a: i2c2@0 {
121c66ec88fSEmmanuel Vadot			pins1 {
122c66ec88fSEmmanuel Vadot				pinmux = <MT8135_PIN_193_SDA2__FUNC_SDA2>;
123c66ec88fSEmmanuel Vadot				bias-pull-down;
124c66ec88fSEmmanuel Vadot			};
125c66ec88fSEmmanuel Vadot
126c66ec88fSEmmanuel Vadot			pins2 {
127c66ec88fSEmmanuel Vadot				pinmux = <MT8135_PIN_49_WATCHDOG__FUNC_GPIO49>;
128c66ec88fSEmmanuel Vadot				bias-pull-up;
129c66ec88fSEmmanuel Vadot			};
130c66ec88fSEmmanuel Vadot		};
131c66ec88fSEmmanuel Vadot
132c66ec88fSEmmanuel Vadot		i2c3_pins_a: i2c3@0 {
133c66ec88fSEmmanuel Vadot			pins1 {
134c66ec88fSEmmanuel Vadot				pinmux = <MT8135_PIN_40_DAC_CLK__FUNC_GPIO40>,
135c66ec88fSEmmanuel Vadot					 <MT8135_PIN_41_DAC_WS__FUNC_GPIO41>;
136c66ec88fSEmmanuel Vadot				bias-pull-up = <55>;
137c66ec88fSEmmanuel Vadot			};
138c66ec88fSEmmanuel Vadot
139c66ec88fSEmmanuel Vadot			pins2 {
140c66ec88fSEmmanuel Vadot				pinmux = <MT8135_PIN_35_SCL3__FUNC_SCL3>,
141c66ec88fSEmmanuel Vadot					 <MT8135_PIN_36_SDA3__FUNC_SDA3>;
142c66ec88fSEmmanuel Vadot				output-low;
143c66ec88fSEmmanuel Vadot				bias-pull-up = <55>;
144c66ec88fSEmmanuel Vadot			};
145c66ec88fSEmmanuel Vadot
146c66ec88fSEmmanuel Vadot			pins3 {
147c66ec88fSEmmanuel Vadot				pinmux = <MT8135_PIN_57_JTCK__FUNC_GPIO57>,
148c66ec88fSEmmanuel Vadot					 <MT8135_PIN_60_JTDI__FUNC_JTDI>;
149c66ec88fSEmmanuel Vadot				drive-strength = <32>;
150c66ec88fSEmmanuel Vadot			};
151c66ec88fSEmmanuel Vadot		};
152c66ec88fSEmmanuel Vadot
153c66ec88fSEmmanuel Vadot		...
154c66ec88fSEmmanuel Vadot	}
155c66ec88fSEmmanuel Vadot};
156